title: Unit test for checking automapper mappings
body: <p>I using automapper and want to write unit test to check if mapping working correctly</p>
  <p>Here is my automapper profile</p>
  <pre><code>  public class MappingsProfile : Profile
  {
      public MappingsProfile()
      {
          #region CompaniesHouse
  
          CreateMap&lt;CompanyHouseDto, InputCompaniesHouseSearchResult&gt;().ReverseMap();
  
          CreateMap&lt;IntegrationCompaniesHouseStateDto, IntegrationCompaniesHouseState&gt;();
  
          #endregion
      }
  }
  </code></pre>
  <p>Here is Test that I already wrote</p>
  <pre><code> public class AutomapperTest
  {
      private static IMapper _mapper;
  
      public AutomapperTest()
      {
          if (_mapper == null)
          {
              var mappingConfig = new MapperConfiguration(mc =&gt;
              {
                  mc.AddProfile(new MappingsProfile());
              });
              IMapper mapper = mappingConfig.CreateMapper();
              _mapper = mapper;
          }
      }
  
      [Fact]
      public void Map_Should_HaveValidConfig() =&gt; _mapper.IsValid();
  
      [Fact]
      public void Map_Should_MapEntityToDto()
      {
          var entity = new InputCompaniesHouseSearchResult();
          var dto = _mapper.Map&lt;CompanyHouseDto&gt;(entity);
  
          Assert.NotNull(dto);
          Assert.IsType&lt;CompanyHouseDto&gt;(dto);
      }
  
      [Fact]
      public void Map_Should_MapDtoToEntity()
      {
          var dto = new CompanyHouseDto();
          var entity = _mapper.Map&lt;InputCompaniesHouseSearchResult&gt;(dto);
  
          Assert.NotNull(dto);
          Assert.IsType&lt;InputCompaniesHouseSearchResult&gt;(entity);
      }
  }
  </code></pre>
  <p>Here is DTO</p>
  <pre><code>    public class CompanyHouseDto
  {
      public string CompanyName { get; set; }
      
      public string CompanyNumber { get; set; }
      
      public string CompanyStatus { get; set; }
      
      public string CompanyType { get; set; }
      
      public string Kind { get; set; }
      
      public string CompanyProfileLink { get; set; }
      
      public string AddressLine1 { get; set; }
      
      public string AddressLine2 { get; set; }
      
      public string Country { get; set; }
      
      public string Locality { get; set; }
      
      public string PostalCode { get; set; }
      
      public string Region { get; set; }
      
      public string SicCodes { get; set; }
      
      public string MatchConfidenceBand { get; set; }
      
      public int MatchConfidenceScore { get; set; }
  }
  </code></pre>
  <p><code>InputCompaniesHouseSearchResult</code> has same fields.</p>
  <p>If I change  AddressLine1 to AddressLineABC all tests will pass, I need test to fail on this  .</p>
  <p>How I need to write tests?</p>