public void FindPublishedByCategory_Should_Return_Paged_Result() { using (BeginTransaction()) { GenerateStories(true, false, true); _database.SubmitChanges(); var categoryName = CreateNewCategory().Name; var category = _database.CategoryDataSource.First(c => c.Name == categoryName); var pagedResult = _storyRepository.FindPublishedByCategory(category.Id, 0, 5); Assert.Equal(5, pagedResult.Result.Count); Assert.Equal(10, pagedResult.Total); } }
public void FindPublishedByCategory_Should_Return_Paged_Result() { var story1 = CreateStory(); var story2 = CreateStory(); var story3 = CreateStory(); var rnd = new Random(); Stories.AddRange(new[] { story1 as Story, story2 as Story, story3 as Story }); Stories.ForEach(s => s.Publish(SystemTime.Now().AddDays(-rnd.Next(1, 5)), rnd.Next(1, 10))); var pagedResult = _storyRepository.FindPublishedByCategory(Stories[0].CategoryId, 0, 10); Assert.Equal(1, pagedResult.Result.Count); Assert.Equal(1, pagedResult.Total); }