public void GetCollection_Property_ShouldReturnCollection()
        {
            var person = new Person();
            var expected = new ContactMethod { Type = ContactMethodType.HomePhone, Value = "555-1234" };
            var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", x => x.ContactMethods);

            mapping.GetCollection(person).ShouldBe(null);

            mapping.AddToCollection(person, expected);

            mapping.GetCollection(person).ShouldNotBe(null);
            mapping.GetCollection(person).ShouldBe(person.ContactMethods);
        }
        public void AddToCollection_Property_ShouldAddMemberAndInstantiateCollectionIfRequired()
        {
            var person = new Person();
            var expected = new ContactMethod{Type = ContactMethodType.HomePhone, Value = "555-1234"};
            var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", x => x.ContactMethods);

            mapping.CreateInstance().ShouldBeTypeOf(typeof(ContactMethod));
            mapping.NamespaceUri.ShouldBe(Ns.NamespaceName);
            mapping.LocalName.ShouldBe("ContactMethod");

            mapping.AddToCollection(person, expected);

            person.ContactMethods[0].ShouldBe(expected);
        }
        public void AddToCollection_ContainingCollection_ShouldAddMemberToMethodArgument()
        {
            var person = new Person {ContactMethods = new List<ContactMethod>()};
            var expected = new ContactMethod {Type = ContactMethodType.HomePhone, Value = "555-1234"};
            var mapping = new CollectionChildElementMapping<Person, ContactMethod>(Ns + "ContactMethod", null);

            mapping.CreateInstance().ShouldBeTypeOf(typeof(ContactMethod));
            mapping.NamespaceUri.ShouldBe(Ns.NamespaceName);
            mapping.LocalName.ShouldBe("ContactMethod");

            mapping.AddToCollection(person.ContactMethods, expected);

            person.ContactMethods[0].ShouldBe(expected);
        }