title: Unit test the Automapper profiles
body: <p><strong>I do want</strong> to test the custom logic in the <code>CreateMap</code> method. I do <strong>NOT</strong> want to test whether the mapping exist at all for some types.</p>
  
  <p>How can I do that or what are the classes that I need to know. I am grateful for every hint The document about. Automapper unit testing seems very rare...</p>
  
  <pre><code>public class UnitProfile : Profile
  {
     protected override void Configure()
     {
        // Here I create my maps with custom logic that needs to be tested
  
      CreateMap&lt;Unit, UnitTreeViewModel&gt;()
           .ForMember(dest =&gt; dest.IsFolder, o =&gt; o.MapFrom(src =&gt; src.UnitTypeState == UnitType.Folder ? true : false));
  
      CreateMap&lt;CreateUnitViewModel, Unit&gt;()
           .ForMember(dest =&gt; dest.UnitTypeState, o =&gt; o.MapFrom(src =&gt; (UnitType)Enum.ToObject(typeof(UnitType), src.SelectedFolderTypeId)));
     }
  }
  </code></pre>