Exemple #1
0
        public void When_campaign_contains_atLeast_1_project_Then_correct_campaign_repo_is_generated()
        {
            var projectRepoTests = new ProjectRepoTests();

            var campaign = CreateCampaign();

            projectRepoTests.CreateProject(campaign.Id);
            projectRepoTests.CreateProject(campaign.Id);

            var report = repo.GetCampaignsAndProjectCounts();

            var campaignFromReport = report.First(r => r.Campaign.Id == campaign.Id);

            Assert.Equal(2, campaignFromReport.ProjectCount);
        }
Exemple #2
0
        public Vote CreateVote(bool isAddedToDb = true)
        {
            var userId = Guid.NewGuid().ToString();

            var project = new ProjectRepoTests().CreateProject();

            var vote = new Vote
            {
                UserId         = userId,
                ProjectId      = project.Id,
                VotingDateTime = DateTime.Now,
                SocialName     = "facebook"
            };

            if (isAddedToDb)
            {
                repo.Add(vote);
            }

            return(vote);
        }
Exemple #3
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);
        }