public void CreateVotingPoll_UsesVotingPollFactoryToCreateVotingPoll() { var factory = new VotingPollFactory(); _interactor.CreateVotingPoll(_request); _mockFactory.Verify(x => x.Create(_request)); }
public void SavesVoteToDatabaseAfterPollCreatedWithInteractor() { _pollInteractor.CreateVotingPoll(new VotingPollFactory.Request { Title = "Title", Description = "Description", Names = new[] { "One", "Two" } }); _votingInteractor.Vote(new Vote { UserId = "user", CounterId = 1 }); AssertVotedForCounter(_ctx, "user", 1); }
public void SavesVoteToDatabaseAfterPollCreatedWithInteractor() { _pollInteractor.CreateVotingPoll(new VotingPollFactory.Request { Title = "Title", Description = "Description", Names = new[] { "One", "Two" } }); _votingInteractor.Vote(new Vote { UserId = "user", CounterId = 1 }); var vote = _ctx.Votes.Single(); Assert.Equal("user", vote.UserId); Assert.Equal(1, vote.CounterId); var counter = _ctx.Counters.Include(x => x.Votes).First(x => x.Id == 1); Assert.Single(counter.Votes); }
public IActionResult OnPost([FromServices] VotingPollInteractor votingPollInteractor) { votingPollInteractor.CreateVotingPoll(Form); return(RedirectToPage("/Index")); }