예제 #1
0
        public IActionResult ReloadProjectVotes(int projectId)
        {
            if (!IsCountryAllowed())
            {
                return(Forbid());
            }

            return(Ok(voteList.GetVotesCountByProject(projectId)));
        }
예제 #2
0
        public void When_getting_votes_Count_ByProject_GetVotesCountByProject_returns_right_votesCount()
        {
            //Setup
            const int testingVotesCount = 2;
            const int testingProjectId  = 1;

            repoMock
            .Setup(r => r.GetVotesCountByProject(testingProjectId))
            .Returns(testingVotesCount);

            //Act
            var result = voteList.GetVotesCountByProject(testingProjectId);

            //Assert
            Assert.Equal(testingVotesCount, result);
            repoMock.Verify(r => r.GetVotesCountByProject(testingProjectId), Times.Once);
        }