public void MapAll_ValidInput_CallsMapper() { var mapperMock = A.Fake<IMapper<TestClassA, TestClassB>>(); var target = new TestClassA[10]; var output = new TestClassB[10]; A.CallTo(() => mapperMock.MapMultiple(target)).Returns(output); var result = target.MapAll<TestClassA, TestClassB>(mapperMock); Assert.AreEqual(output, result); }
public void MapTo_ValidInputAndTarget_UsesDefaultRepo() { 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); MappingRepository.Default.Clear(); MappingRepository.Default.AddMapper <TestClassC, TestClassB>(mapperMock); var actual = source.MapTo <TestClassB>(expected); 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_NullTarget_Throws_3() { var source = new TestClassB(); source.MapTo <TestClassC>((TestClassC)null, A.Fake <IMappingRepository>()); }
public void MapTo_NullTarget_Throws_2() { var source = new TestClassB(); source.MapTo <TestClassC>((TestClassC)null, A.Fake <IMapper>()); }
public void MapTo_NullTarget_Throws_1() { var source = new TestClassB(); source.MapTo <TestClassC>((TestClassC)null); }
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(); }
public void MapTo_NullTarget_Throws_3() { var source = new TestClassB(); source.MapTo<TestClassC>((TestClassC)null, A.Fake<IMappingRepository>()); }
public void MapTo_NullTarget_Throws_2() { var source = new TestClassB(); source.MapTo<TestClassC>((TestClassC)null, A.Fake<IMapper>()); }
public void MapTo_NullTarget_Throws_1() { var source = new TestClassB(); source.MapTo<TestClassC>((TestClassC)null); }