public void CreateAccessorChain_SingleElement() { var chain = MapperUtils.CreateAccessorChain(MemberExpressions.GetExpressionChain <ClassWithSeveralPropertiesDest>(c => c.Child)); Assert.IsNotNull(chain); var destination = new ClassWithSeveralPropertiesDest(); var child = new ChildClass(); chain.Set(destination, child); Assert.AreSame(child, destination.Child); }
public void CreateAccessorChain_MultipleElements_WithConstruction() { var resourceMapper = new ResourceMapper <object>(); resourceMapper.InitializeMap(); var chain = MapperUtils.CreateConstructingAccessorChain <object>(MemberExpressions.GetExpressionChain <ClassWithSeveralPropertiesDest>(c => c.Child.String), resourceMapper); Assert.IsNotNull(chain); var destination = new ClassWithSeveralPropertiesDest(); const string child = "teststring"; chain(destination, child, null); Assert.AreSame(child, destination.Child.String); }