Beispiel #1
0
        public void Search_Should_Return_Correct_Result()
        {
            var story1 = CreateStory();
            var story2 = CreateStory();
            var story3 = CreateStory();

            Stories.AddRange(new[] { story1 as Story, story2 as Story, story3 as Story });

            var pagedResult = _storyRepository.Search("Test", 0, 10);

            Assert.Equal(3, pagedResult.Result.Count);
            Assert.Equal(3, pagedResult.Total);
        }
        public void Search_Should_Return_Correct_Result()
        {
            using (BeginTransaction())
            {
                GenerateStories(true, false, true);

                _database.SubmitChanges();

                var pagedResult = _storyRepository.Search("dummy", 0, 5);

                Assert.Equal(5, pagedResult.Result.Count);
                Assert.True(pagedResult.Total >= 10);
            }
        }
Beispiel #3
0
        public void Search_Should_Return_Correct_Result()
        {
            var story1 = CreateStory();
            var story2 = CreateStory();

            Stories.AddRange(new[] { story1 as Story, story2 as Story });

            database.Setup(db => db.StorySearchResult).Returns((new List <Guid> {
                story1.Id, story2.Id
            }).AsQueryable());

            var pagedResult = _storyRepository.Search("Test", 0, 10);

            Assert.Equal(2, pagedResult.Result.Count);
            Assert.Equal(2, pagedResult.Total);
        }
        public void Search_Should_Return_Correct_Result()
        {
            var story1 = CreateStory();
            var story2 = CreateStory();

            Stories.AddRange(new[] { story1 as Story, story2 as Story });

            database.Setup(db => db.StorySearch(It.IsAny <string>())).Returns((new List <StorySearchResult> {
                new StorySearchResult {
                    Id = story1.Id
                }
            }).AsQueryable());
            database.Setup(db => db.CommentSearch(It.IsAny <string>())).Returns((new List <CommentSearchResult> {
                new CommentSearchResult {
                    StoryId = story2.Id
                }
            }).AsQueryable());

            var pagedResult = _storyRepository.Search("Test", 0, 10);

            Assert.Equal(2, pagedResult.Result.Count);
            Assert.Equal(2, pagedResult.Total);
        }