Exemplo n.º 1
0
        protected override void Because_of()
        {
            var parent = new ParentModel {
                ID = "PARENT_ONE"
            };

            parent.AddChild(new ChildModel {
                ID = "CHILD_ONE"
            });

            parent.AddChild(new ChildModel {
                ID = "CHILD_TWO"
            });

            _dto = Mapper.Map <ParentModel, ParentDto>(parent);
        }
Exemplo n.º 2
0
        public void Should_work()
        {
            var parent = new ParentModel {
                ID = "PARENT_ONE"
            };

            parent.ChildrenStruct = new ChildrenStructModel {
                Children = new List <ChildModel>()
            };

            parent.AddChild(new ChildModel {
                ID = "CHILD_ONE"
            });

            parent.AddChild(new ChildModel {
                ID = "CHILD_TWO"
            });

            _dto = Mapper.Map <ParentModel, ParentDto>(parent);

            _dto.ID.ShouldBe("PARENT_ONE");
            _dto.ChildrenStruct.Children[0].ID.ShouldBe("CHILD_ONE");
            _dto.ChildrenStruct.Children[1].ID.ShouldBe("CHILD_TWO");
        }