title: How to set ValidateInlineMaps in a Unit Test to test the Mapping of AutoMapper
body: <p>I have the following test in which I want to test an AutoMapping while turning off ValidateInlineMaps, but the setting seems to have no effect. Am I doing it in the wrong way? Basically I am doing it like this:</p>
  <p>'Mapper.Initialize(m =&gt; { m.ValidateInlineMaps = false;            m.AddProfile();  });'</p>
  <p>I expected my test to pass 'AssertConfigurationIsValid' but it does not.</p>
  <p>The full code of the test is:</p>
  <pre><code>using AutoMapper;
  using Domain.Database.Entities;
  using Shared.DTO.v000;
  using NUnit.Framework;
  using Domain.Bootstrap.Profiles;
  
  namespace Tests
  {
      [TestFixture]
      public class ProfileMappersTest
      {
          [SetUp]
          public void Setup()
          {
          }
  
  
          [Test]
          public void AutoMapper_Configuration_IsValid()
          {
              Mapper.Initialize(m =&gt; { 
                  m.ValidateInlineMaps = false;  
                  m.AllowNullCollections = true; 
                  m.AllowNullDestinationValues = true; 
                  m.AddProfile&lt;CustomerContactProfile&gt;();  });
              Mapper.AssertConfigurationIsValid();
  
              MapperConfiguration configuration = new MapperConfiguration(cfg =&gt;
                cfg.CreateMap&lt;Customer, CustomerDTO&gt;());
  
              configuration.AssertConfigurationIsValid();
  
          }
      }
  }
  
  </code></pre>