예제 #1
0
        public void ShouldAddCompactUriLinkRelationNamespacesToRootShopElement()
        {
            const string ns1 = "http://restbucks/relations/";
            const string ns2 = "http://thoughtworks/relations/";

            var rel1 = new CompactUriLinkRelation("rb", new Uri(ns1, UriKind.Absolute), "rel1");
            var rel2 = new CompactUriLinkRelation("tw", new Uri(ns2, UriKind.Absolute), "rel2");

            var shop = new ShopBuilder(new Uri("http://locahost/"))
                .AddLink(new Link(new Uri("/quotes", UriKind.Relative), RestbucksMediaType.Value, rel1, rel2))
                .Build();

            var xml = new XmlOutput(new ShopFormatter(shop).CreateXml());

            Assert.AreEqual(ns1, xml.GetNamespaceValue("rb"));
            Assert.AreEqual(ns2, xml.GetNamespaceValue("tw"));
        }