Ejemplo n.º 1
0
        public async Task TwoVotesOnGuideFromOneUserShouldCountOnce()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var context                  = new ApplicationDbContext(options.Options);
            var postRepository           = new EfRepository <VoteOnPost>(context);
            var guideRepository          = new EfRepository <VoteOnGuide>(context);
            var suggestionGameRepository = new EfRepository <VoteOnSuggestionGame>(context);
            var service                  = new VotesService(postRepository, guideRepository, suggestionGameRepository);

            await service.VoteOnGuideAsync("1", "1", true);

            await service.VoteOnGuideAsync("1", "1", true);

            var actual = await service.GetVotesOnGuideAsync("1");

            Assert.Equal(1, actual);
        }