Example #1
0
        public void IListsAreReferenceEquals()
        {
            var mapper = new MemberMapper();

            var source = new SourceSharedIList {
                Foo = new List <SharedNested>()
                {
                    new SharedNested()
                }
            };

            var result = mapper.Map(source, new DestinationSharedIList());

            Assert.IsTrue(object.ReferenceEquals(source.Foo, result.Foo));
        }
Example #2
0
        public void IListsAreNotReferenceEqualsWhenDestinationIsNotEmpty()
        {
            var mapper = new MemberMapper();

            var source = new SourceSharedIList {
                Foo = new List <SharedNested> {
                    new SharedNested {
                        Value = "bla"
                    }
                }
            };

            var result = mapper.Map(source, new DestinationSharedIList {
                Foo = new List <SharedNested> {
                    new SharedNested {
                        Value = "test"
                    }
                }
            });

            Assert.IsFalse(object.ReferenceEquals(source.Foo, result.Foo));
            Assert.AreEqual("test", result.Foo.First().Value);
            Assert.AreEqual("bla", result.Foo.Last().Value);
        }
Example #3
0
        public void IListsAreReferenceEquals()
        {
            var mapper = new MemberMapper();

              var source = new SourceSharedIList { Foo = new List<SharedNested>() { new SharedNested() } };

              var result = mapper.Map(source, new DestinationSharedIList());

              Assert.IsTrue(object.ReferenceEquals(source.Foo, result.Foo));
        }
Example #4
0
        public void IListsAreNotReferenceEqualsWhenDestinationIsNotEmpty()
        {
            var mapper = new MemberMapper();

              var source = new SourceSharedIList { Foo = new List<SharedNested> { new SharedNested { Value = "bla" } } };

              var result = mapper.Map(source, new DestinationSharedIList { Foo = new List<SharedNested> { new SharedNested { Value = "test" } } });

              Assert.IsFalse(object.ReferenceEquals(source.Foo, result.Foo));
              Assert.AreEqual("test", result.Foo.First().Value);
              Assert.AreEqual("bla", result.Foo.Last().Value);
        }