public void FindPromotedByUser_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 user = _factory.CreateUser("promoter", "*****@*****.**", "xxxxxx");

            Stories.ForEach(s => Votes.Add(new StoryVote {
                User = (User)user, Story = s, IPAddress = "192.168.0.1", Timestamp = SystemTime.Now().AddDays(-3)
            }));

            var pagedResult = _storyRepository.FindPromotedByUser(user.Id, 0, 10);

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

                _database.SubmitChanges();
                var userName = CreateNewUser().UserName;
                var stories  = _database.StoryDataSource.Where(s => s.User.UserName == userName);

                var newUser = (User)_domainFactory.CreateUser("promoterUser", "*****@*****.**", "Pa$$w0rd");

                stories.ForEach(s => s.StoryVotesInternal.Add(new StoryVote {
                    User = newUser, Story = s, IpAddress = "192.168.0.5", Timestamp = SystemTime.Now()
                }));
                _database.SubmitChanges();

                var pagedResult = _storyRepository.FindPromotedByUser(newUser.Id, 0, 5);

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