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")); }
public void ValueShouldReturnAbsoluteUri() { var linkRelation = new CompactUriLinkRelation("rb", new Uri("http://relations.restbucks.com/"), "order-form"); Assert.AreEqual("http://relations.restbucks.com/order-form", linkRelation.Value); }
public void ShouldIncludeColonsFromReferenceInValue() { var linkRelation = new CompactUriLinkRelation("rb", new Uri("http://relations.restbucks.com/"), "order:first"); Assert.AreEqual("http://relations.restbucks.com/order:first", linkRelation.Value); }
public void ShouldIncludeFragmentIdentifierFromPrefixInValue() { var linkRelation = new CompactUriLinkRelation("rb", new Uri("http://relations.restbucks.com/#"), "order-form"); Assert.AreEqual("http://relations.restbucks.com/#order-form", linkRelation.Value); }
public void SerializableValueShouldReturnCompactUri() { var linkRelation = new CompactUriLinkRelation("rb", new Uri("http://relations.restbucks.com/"), "order-form"); Assert.AreEqual("rb:order-form", linkRelation.DisplayValue); }