Exemplo n.º 1
0
        public void ShouldResetMapper()
        {
            //Arrange
            Mapper.CreateMap <object, object>();
            var mapperExtension = new AutoMapperExtension(registrationHelper);

            Assert.AreNotEqual(0, Mapper.GetAllTypeMaps().Length);

            //Act
            mapperExtension.Reset();

            //Assert
            Assert.AreEqual(0, Mapper.GetAllTypeMaps().Length);
        }
        public void ShouldResetMapper()
        {
            //Arrange
            var containerExtension = A.Fake <IBootstrapperContainerExtension>();
            var profiles           = new List <Profile> {
                new TestAutoMapperProfile()
            };

            A.CallTo(() => containerExtension.ResolveAll <Profile>()).Returns(profiles);
            Bootstrapper.With.Extension(containerExtension);
            var mapperExtension = new AutoMapperExtension(registrationHelper);

            mapperExtension.Run();
            Assert.AreNotEqual(0, AutoMapperExtension.ConfigurationProvider.GetAllTypeMaps().Length);

            //Act
            mapperExtension.Reset();

            //Assert
            Assert.AreEqual(0, AutoMapperExtension.ConfigurationProvider.GetAllTypeMaps().Length);
        }