public void MapModelOnly_TwoNestedLevel_ShouldMap() { var source = new NestedLinkedSource { Model = CreateMyComplexModel(1, 2), Child = new NestedLinkedSource { Model = CreateMyComplexModel(2, 3), Child = new NestedLinkedSource { Model = CreateMyComplexModel(3, null), Child = null } } }; var actual = _mapper.Map <MyComplexDto>(source); Assert.Equal(source.Model.Id, actual.Id); Assert.Equal(source.Model.Title, actual.Title); Assert.Equal(source.Model.Point.X, actual.Point.X); Assert.Equal(source.Model.Point.Y, actual.Point.Y); Assert.Equal(source.Child.Model.Id, actual.Child.Id); Assert.Equal(source.Child.Model.Title, actual.Child.Title); Assert.Equal(source.Child.Model.Point.X, actual.Child.Point.X); Assert.Equal(source.Child.Model.Point.Y, actual.Child.Point.Y); Assert.Equal(source.Child.Child.Model.Id, actual.Child.Child.Id); Assert.Equal(source.Child.Child.Model.Title, actual.Child.Child.Title); Assert.Equal(source.Child.Child.Model.Point.X, actual.Child.Child.Point.X); Assert.Equal(source.Child.Child.Model.Point.Y, actual.Child.Child.Point.Y); }
public void MapModelOnly_WithIntAndComplexType_ShouldMap() { var source = new NestedLinkedSource { Model = CreateMyComplexModel(1, null), Child = null }; var actual = _mapper.Map <MyComplexDto>(source); Assert.Equal(source.Model.Id, actual.Id); Assert.Equal(source.Model.Title, actual.Title); Assert.Equal(source.Model.Point.X, actual.Point.X); Assert.Equal(source.Model.Point.Y, actual.Point.Y); Assert.Null(actual.Child); }