public void AMessageIsProvidedForUser() { _voter = new StoryVoter(); var result = _voter.AddVote(_story.ID); var result2 = _voter.AddVote(_story.ID); Assert.False(result2.VoteSucceeded); Assert.Equal("Only 1 vote per story allowed every 10 seconds :-)", result2.Message); }
public void RatingIsNotIncrementedBy1() { _voter = new StoryVoter(); var result = _voter.AddVote(_story.ID); Assert.Equal(1, result.Story.Rating); var result2 = _voter.AddVote(_story.ID); Assert.Equal(1, result2.Story.Rating); }
public void AMessageIsProvidedForUser() { _voter = new StoryVoter(); var result = _voter.AddVote(_story.ID); Assert.Equal("Thank you for voting!", result.Message); Assert.Equal(true, result.VoteSucceeded); }
public ActionResult Vote(int?storyID, string sortOrder = "ratingDescending") { var sv = new StoryVoter(); var result = sv.AddVote(storyID); // Display success or fail message of voting return(RedirectToAction("Index", "Home", new { sortOrder = sortOrder, message = result.Message })); }