コード例 #1
0
 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);
 }
コード例 #2
0
 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();
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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();
        }