Esempio n. 1
0
        public void Map_PassedTAndNoConstructor_ReturnsMappedObject()
        {
            // arrange
            var converter = new TestObjectMapper();

            // act
            var orange = converter.CreateInstance(new Apple {
                Type = "TEST"
            });

            // assert
            Assert.AreEqual("TEST", orange.Type);
        }
Esempio n. 2
0
        public void Map_PassedTAndMappingConfigurationInConstructor_ReturnsMappedObject()
        {
            // arrange

            var mappingConfiguration = ConfigurationHelpers.CreateDefaultConfiguration();

            mappingConfiguration.CreateMap <Apple, Orange>();

            var converter = new TestObjectMapper(mappingConfiguration);

            // act
            var orange = converter.CreateInstance(new Apple {
                Type = "TEST"
            });

            // assert
            Assert.AreEqual("TEST", orange.Type);
        }
Esempio n. 3
0
        public void Map_PassedT_ReturnsResultFromAutoMapper()
        {
            // arrange
            var expectedOrange = new Orange();

            var apple = new Apple();

            var mappingEngineFake = new Mock <IMappingEngine>();

            mappingEngineFake.Setup(x => x.Map <Apple, Orange>(apple))
            .Returns(expectedOrange);

            var converter = new TestObjectMapper(mappingEngineFake.Object);

            // act
            var orange = converter.CreateInstance(apple);

            // assert
            Assert.AreSame(expectedOrange, orange);
        }