public void CanSelectAndBindLinkAsTemplate() { // Arrange AtomLink link1 = new AtomLink("http://host/api/items/{id}", "template", MediaType.ApplicationXHtml, "Templated link"); AtomLink link2 = new AtomLink("http://host/api/other/stuff/1234", "other", MediaType.ApplicationXHtml, "Simple link"); AtomLinkList links = new AtomLinkList(); links.Add(link1); links.Add(link2); // Act Request req = links.Select("template").Bind(Session, new { id = 20 }); // Assert Assert.IsNotNull(req); Assert.IsNotNull(req.Session); Assert.AreEqual(new Uri("http://host/api/items/20"), req.Url); }
protected override void SetUp() { base.SetUp(); Uri baseUrl = new Uri("http://unused"); Link1 = new AtomLink(baseUrl, "http://dr.dk/", "tv", "text/html", "Danish Television"); Link2 = new AtomLink(baseUrl, "http://elfisk.dk/", "home", "text/html", "Jorns website"); Link3 = new AtomLink(baseUrl, "http://dr.dk/atom", "tv", "application/atom+xml", "Danish Television feed"); Link4 = new AtomLink(baseUrl, "http://elfisk.dk/atom", "home", "application/atom+xml", "Jorns website feed"); Link5 = new AtomLink(baseUrl, "http://elfisk.dk/abc", "search previous first", "text/html", "Blah 1"); Link6 = new AtomLink(baseUrl, "http://elfisk.dk/def", "search previous first", "application/atom+xml", "Blah 2"); Link7 = new AtomLink(baseUrl, "http://elfisk.dk/123", "UPPERCASE lowercase", "text/html", "Blah 3"); Links = new AtomLinkList(); Links.Add(Link1); Links.Add(Link2); Links.Add(Link3); Links.Add(Link4); Links.Add(Link5); Links.Add(Link6); Links.Add(Link7); MyResource = new Resource { Links = Links }; }