Ejemplo n.º 1
0
        public void Map_PassedTAndOutVariable_SetsOutValueToMappedResult()
        {
            // arrange
            var expectedOrange = new Orange();

            var apple  = new Apple();
            var orange = new Orange();

            var mappingEngineFake = new Mock <IMappingEngine>();

            var converter = new TestObjectMapper(mappingEngineFake.Object);

            // act
            converter.LoadIntoInstance(apple, orange);

            // assert
            mappingEngineFake.Verify(x => x.Map(apple, orange), Times.Once());
        }
Ejemplo n.º 2
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);
        }