public void SetOnContainer_ShouldWriteToContainer() { var person = new Person(); var mapping = new ChildElementMapping<Person, Address>(Ns + "Address", x => x.Address); var expected = new Address {StreetName = "231 Queen Street", City = "Auckland"}; mapping.SetOnContainer(person, expected); person.Address.ShouldBe(expected); }
public void GetFromContainer_ShouldReadFromContainer() { var person = new Person {Address = new Address {StreetName = "231 Queen Street", City = "Auckland"}}; var mapping = new ChildElementMapping<Person, Address>(Ns + "Address", x => x.Address); mapping.CreateInstance().ShouldBeTypeOf(typeof(Address)); mapping.NamespaceUri.ShouldBe(Ns.NamespaceName); mapping.LocalName.ShouldBe("Address"); var actual = mapping.GetFromContainer(person); actual.ShouldBe(person.Address); }