public void FindAfter_Should_Return_Correct_Votes() { using (BeginTransaction()) { var vote = CreateNewStoryVote(); _database.InsertOnSubmit(vote); _database.SubmitChanges(); var date = vote.PromotedAt.AddDays(-1); var storyId = vote.StoryId; var userId = vote.UserId; var count = _database.VoteDataSource.Count(v => v.StoryId == storyId && v.Timestamp >= date); var result = _voteRepository.FindAfter(storyId, date); Assert.NotNull(_voteRepository.FindById(storyId, userId)); Assert.Equal(count, result.Count); } }
public void FindAfter_Should_Return_Correct_Votes() { var now = SystemTime.Now().AddDays(-1); var storyId = Guid.NewGuid(); Votes.Add(new StoryVote { StoryId = storyId, Timestamp = now.AddHours(1) }); Votes.Add(new StoryVote { StoryId = storyId, Timestamp = now.AddHours(2) }); Votes.Add(new StoryVote { StoryId = storyId, Timestamp = now.AddHours(3) }); var result = _voteRepository.FindAfter(storyId, now); Assert.Equal(3, result.Count); }