private static XDocument Serialise(LinkResource linkResource)
 {
     var xmlSerialiser = new XmlSerializer(typeof(LinkResource));
     using (var sw = new StringWriter())
     {
         xmlSerialiser.Serialize(sw, linkResource);
         return XDocument.Parse(sw.ToString());
     }
 }
        public void Basket_element_has_a_self_link_element()
        {
            var selfLink = new LinkResource { Relation = "self", Uri = "doody"};
            var basket = new BasketResource { SelfLink = selfLink };

            var basketXml = Serialise(basket);

            var selfLinkElement = basketXml.Root.Elements("link").Where(l => l.Attribute("rel").Value == "self").Single();
            Assert.That(selfLinkElement, Is.Not.Null);

            var selfLinkUriAttribute = selfLinkElement.Attribute("uri").Value;
            Assert.That(selfLinkUriAttribute, Is.EqualTo(selfLink.Uri));
        }