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);
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
        public void MapTo_NullTarget_Throws_3()
        {
            var source = new TestClassB();

            source.MapTo <TestClassC>((TestClassC)null, A.Fake <IMappingRepository>());
        }
Esempio n. 5
0
        public void MapTo_NullTarget_Throws_2()
        {
            var source = new TestClassB();

            source.MapTo <TestClassC>((TestClassC)null, A.Fake <IMapper>());
        }
Esempio n. 6
0
        public void MapTo_NullTarget_Throws_1()
        {
            var source = new TestClassB();

            source.MapTo <TestClassC>((TestClassC)null);
        }
Esempio n. 7
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();
 }
Esempio n. 8
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();
 }
Esempio n. 9
0
 public void MapTo_NullTarget_Throws_3()
 {
     var source = new TestClassB();
     source.MapTo<TestClassC>((TestClassC)null, A.Fake<IMappingRepository>());
 }
Esempio n. 10
0
 public void MapTo_NullTarget_Throws_2()
 {
     var source = new TestClassB();
     source.MapTo<TestClassC>((TestClassC)null, A.Fake<IMapper>());
 }
Esempio n. 11
0
 public void MapTo_NullTarget_Throws_1()
 {
     var source = new TestClassB();
     source.MapTo<TestClassC>((TestClassC)null);
 }