public void FilterByTag(int tag) { var blogs = bops.BlogsByTag(tag); foreach (var blog in blogs) { IEnumerable <Tag> tags = blog.Tags.Where(r => r.TagId == tag); Assert.IsTrue(tags.Count() != 0); } }
//Testing new pagination/routing public ActionResult Blog(int?id, int?page) { var repo = RepositoryFactory.CreateRepository(); var vm = new BlogVM(); vm.BlogEntries = _blops.GetUnexpiredPosts(); if (id != null) { vm.BlogEntries = _blops.BlogsByTag(id); } var pageNumber = page ?? 1; // The 2nd param in the next line defines the size of the page vm.BlogEntries = vm.BlogEntries.ToPagedList(pageNumber, 5); vm.Tags = repo.GetAllTags(); return(View(vm)); }