public void PicksUpOrdersLinkFromCustomers()
        {
            var content = new Content(new CustomerHandler(), new[] {new Customer {Id = 42}});
            var target = new XmlContentTypeHandler();
            string actual;
            using (var stream = new NonClosingMemoryStream(new MemoryStream()))
            {
                target.Write(content, stream);
                stream.Position = 0;
                using (var reader = new StreamReader(stream))
                {
                    actual = reader.ReadToEnd();
                }
                stream.ForceDispose();
            }
            Assert.NotNull(actual);

            var root = XElement.Parse(actual);
            Assert.Equal("Customers", root.Name.LocalName);
            var customer = root.Elements().FirstOrDefault(x => x.Name.LocalName == "Customer");
            XElement id = customer.Element(customer.GetDefaultNamespace() + "Id");
            Assert.NotNull(id);
            Assert.Equal("42", id.Value);
            var links = customer.Elements("link").ToList();
            Assert.Equal(2, links.Count);
        }
        public void SerializesOrder()
        {
            var content = new Content(new OrderHandler(), new Order {Id = 54, CustomerId = 42});
            var target = new XmlContentTypeHandler();
            string actual;
            using (var stream = new NonClosingMemoryStream(new MemoryStream()))
            {
                target.Write(content, stream);
                stream.Position = 0;
                using (var reader = new StreamReader(stream))
                {
                    actual = reader.ReadToEnd();
                }
                stream.ForceDispose();
            }
            Assert.NotNull(actual);

            var root = XElement.Parse(actual);
            Assert.Equal("Order", root.Name.LocalName);
            XElement id = root.Element(root.GetDefaultNamespace() + "Id");
            Assert.NotNull(id);
            Assert.Equal("54", id.Value);
            
            XElement customerId = root.Element(root.GetDefaultNamespace() + "CustomerId");
            Assert.NotNull(customerId);
            Assert.Equal("42", customerId.Value);
        }