Exemple #1
0
        public void MapTo_ValidInputAndTarget_UsesProvidedMapper()
        {
            var source     = new TestClassC();
            var mapperMock = A.Fake <IExtensibleMapper <TestClassC, TestClassB> >();
            var expected   = new TestClassB();

            A.CallTo(() => mapperMock.Map((object)source, (object)expected)).Returns(expected);
            var actual = source.MapTo <TestClassB>(expected, mapperMock);

            Assert.AreEqual(expected, actual);
            MappingRepository.Default.Clear();
        }
Exemple #2
0
        public void MapTo_ValidInput_UsesProvidedRepo()
        {
            var source     = new TestClassC();
            var mapperMock = A.Fake <IExtensibleMapper <TestClassC, TestClassB> >();
            var expected   = new TestClassB();

            A.CallTo(() => mapperMock.Map((object)source)).Returns(expected);
            var repoMock = A.Fake <IMappingRepository>();

            A.CallTo(() => repoMock.ResolveMapper(typeof(TestClassC), typeof(TestClassB))).Returns(mapperMock);
            var actual = source.MapTo <TestClassB>(repoMock);

            Assert.AreEqual(expected, actual);
            MappingRepository.Default.Clear();
        }
 public void MapTo_ValidInput_UsesProvidedRepo()
 {
     var source = new TestClassC();
     var mapperMock = A.Fake<IExtensibleMapper<TestClassC, TestClassB>>();
     var expected = new TestClassB();
     A.CallTo(() => mapperMock.Map((object)source)).Returns(expected);
     var repoMock = A.Fake<IMappingRepository>();
     A.CallTo(() => repoMock.ResolveMapper(typeof(TestClassC), typeof(TestClassB))).Returns(mapperMock);
     var actual = source.MapTo<TestClassB>(repoMock);
     Assert.AreEqual(expected, actual);
     MappingRepository.Default.Clear();
 }
 public void MapTo_ValidInputAndTarget_UsesProvidedMapper()
 {
     var source = new TestClassC();
     var mapperMock = A.Fake<IExtensibleMapper<TestClassC, TestClassB>>();
     var expected = new TestClassB();
     A.CallTo(() => mapperMock.Map((object)source, (object)expected)).Returns(expected);
     var actual = source.MapTo<TestClassB>(expected, mapperMock);
     Assert.AreEqual(expected, actual);
     MappingRepository.Default.Clear();
 }