public void Get_NonexistentCid() { using (var router = new ContentRouter()) { var providers = router.Get(cid1); Assert.AreEqual(0, providers.Count()); } }
public void Get_Expired() { using (var router = new ContentRouter()) { router.Add(cid1, self.Id, DateTime.MinValue); var providers = router.Get(cid1); Assert.AreEqual(0, providers.Count()); } }
public void Add() { using (var router = new ContentRouter()) { router.Add(cid1, self.Id); var providers = router.Get(cid1); Assert.AreEqual(1, providers.Count()); Assert.AreEqual(self.Id, providers.First()); } }
public void Add_MultipleProviders() { using (var router = new ContentRouter()) { router.Add(cid1, self.Id); router.Add(cid1, other.Id); var providers = router.Get(cid1).ToArray(); Assert.AreEqual(2, providers.Length); CollectionAssert.Contains(providers, self.Id); CollectionAssert.Contains(providers, other.Id); } }
public void RootPageWithNonNullUrlSegment() { var root = new Page { UrlSegment = "lorem", }; var result = new ContentRouter(new RootContentRouter(new TestContentSegmentRouter(root)), new TestRoutableRootContentProvider(root)).RouteContent(new List <string> { "lorem" }, null); Assert.Same(root, result); }
public void PageUnderRootPageWithNullUrlSegment() { var root = new Page { Id = "root", UrlSegment = null, }; var page = new Page { ParentId = root.Id, UrlSegment = "ipsum", }; var result = new ContentRouter(new RootContentRouter(new TestContentSegmentRouter(root, page)), new TestRoutableRootContentProvider(root)).RouteContent(new List <string> { "ipsum" }, null); Assert.Same(page, result); }