public void MapAll_ValidInput_CallsRepository() { var mapperMock = A.Fake<IExtensibleMapper<TestClassE, TestClassC>>(); var target = new TestClassE[10]; var output = new TestClassC[10]; A.CallTo(() => mapperMock.MapMultiple(target)).Returns(output); var repoMock = A.Fake<IMappingRepository>(); A.CallTo(() => repoMock.ResolveMapper<TestClassE, TestClassC>()).Returns(mapperMock); var result = target.MapAll<TestClassE, TestClassC>(repoMock); Assert.AreEqual(output, result); }
public void MapAll_ValidInput_CallsDefaultRepository() { MappingRepository.Default.Clear(); var mapperMock = A.Fake<IExtensibleMapper<TestClassE, TestClassC>>(); var target = new TestClassE[10]; var output = new TestClassC[10]; A.CallTo(() => mapperMock.MapMultiple(target)).Returns(output); MappingRepository.Default.AddMapper(mapperMock); IEnumerable<TestClassC> result = target.MapAll<TestClassE, TestClassC>(); Assert.AreEqual(output, result); MappingRepository.Default.Clear(); }
public void MapAll_ValidInput_CallsRepository() { var mapperMock = A.Fake <IExtensibleMapper <TestClassE, TestClassC> >(); var target = new TestClassE[10]; var output = new TestClassC[10]; A.CallTo(() => mapperMock.MapMultiple(target)).Returns(output); var repoMock = A.Fake <IMappingRepository>(); A.CallTo(() => repoMock.ResolveMapper <TestClassE, TestClassC>()).Returns(mapperMock); IEnumerable <TestClassC> result = target.MapAll <TestClassE, TestClassC>(repoMock); Assert.AreEqual(output, result); }
public void MapAll_ValidInput_CallsDefaultRepository() { MappingRepository.Default.Clear(); var mapperMock = A.Fake <IExtensibleMapper <TestClassE, TestClassC> >(); var target = new TestClassE[10]; var output = new TestClassC[10]; A.CallTo(() => mapperMock.MapMultiple(target)).Returns(output); MappingRepository.Default.AddMapper <TestClassE, TestClassC>(mapperMock); var result = target.MapAll <TestClassE, TestClassC>(); Assert.AreEqual(output, result); MappingRepository.Default.Clear(); }