Пример #1
0
        public void When_getting_votes_count_of_project_GetVotesCountByProject_returns_right_value()
        {
            var projectWithVotes    = new ProjectRepoTests().CreateProject();
            var projectWithoutVotes = new ProjectRepoTests().CreateProject();

            var vote = new Vote()
            {
                ProjectId      = projectWithVotes.Id,
                SocialName     = "facebook",
                UserId         = Guid.NewGuid().ToString(),
                VotingDateTime = DateTime.Now
            };

            repo.Add(vote);

            //Act
            var projectWithoutVotesCount = repo.GetVotesCountByProject(projectWithoutVotes.Id);
            var projectWithVotesCount    = repo.GetVotesCountByProject(projectWithVotes.Id);

            //Assert
            Assert.Equal(0, projectWithoutVotesCount);
            Assert.Equal(1, projectWithVotesCount);
        }
Пример #2
0
 public virtual int GetVotesCountByProject(int projectId)
 {
     return(repo.GetVotesCountByProject(projectId));
 }