public void CaseThereAreThreeEqualVotes_ShouldReturnOneInstanceOfVotesPerSong_With3Votes() { var song = new Song(); var firstVote = new Vote(); firstVote.VotedSong = song; var secondVote = new Vote(); secondVote.VotedSong = song; var thirdVote = new Vote(); thirdVote.VotedSong = song; List<Vote> votesList = new List<Vote>() {firstVote, secondVote, thirdVote}; this.voteDAO.Setup(x => x.VotesCastedTo(band)).Returns(votesList); var votes = this.votePoll.AllVotesPerSongForBand(band); var uniqVote = votes.First(); Assert.AreEqual(1, votes.Count()); Assert.AreEqual(3, uniqVote.NumberOfVotes); Assert.AreEqual(song, uniqVote.Song); }
public void CaseThereAreTwoDifferentVotes_ShouldReturnTwoInstancesOfVotesPerSong_With1VoteEach() { var song = new Song(); var firstVote = new Vote(); firstVote.VotedSong = song; var secondVote = new Vote(); var otherSong = new Song(); secondVote.VotedSong = otherSong; List<Vote> votesList = new List<Vote>() { firstVote, secondVote }; this.voteDAO.Setup(x => x.VotesCastedTo(band)).Returns(votesList); var votes = this.votePoll.AllVotesPerSongForBand(band); Assert.AreEqual(2, votes.Count()); var voteOne = votes.First(); Assert.AreEqual(1, voteOne.NumberOfVotes); Assert.AreEqual(song, voteOne.Song); var voteTwo = votes.Last(); Assert.AreEqual(1, voteTwo.NumberOfVotes); Assert.AreEqual(otherSong, voteTwo.Song); }
public void VotesPerBand_ShouldReturnOne() { Band myNewBand = new Band(); myNewBand.BandName = "My Band"; bandDao.Save(myNewBand); var bandSong = new Band() { BandName = "Ozzy Osbourne" }; bandDao.Save(bandSong); Song song = new Song(); song.Band = bandSong; song.SongName = "Crazy Train"; songDao.Save(song); Vote vote = new Vote(); vote.VotedBand = myNewBand; vote.VotedSong = song; vote.VotingDate = DateTime.Now; voteDao.Save(vote); IList<Vote> votesCasted = voteDao.VotesCastedTo(myNewBand); Assert.AreEqual(1, votesCasted.Count); }
public void SaveVote(Vote NewVote) { VoteDAO.Save(NewVote); }
public void DeleteTheVote(Vote vote) { VoteDAO.Delete(vote); }