public void Side_One_Wins() { //Assert playGame.Setup(g => g.Play()).Returns(Side.One); //Act var result = target.Play(); //Assert Assert.AreEqual(Side.One, result); Assert.AreEqual(7, target.GetGameScores().Count); }
public void Team_One_Wins() { //Assert _playGame.Setup(g => g.Play()).Returns(Team.One); //Act var result = _target.Play(); //Assert Assert.AreEqual(Team.One, result); Assert.AreEqual(7, _target.GetGameScores().Count()); }
public ISide Play() { match = new Match(); setScores = new List <SetScore>(); setScores.Add(new SetScore() { Score = match.PrintScore() }); while (match.State != MatchState.MatchWonBySideOne && match.State != MatchState.MatchWonBySideTwo) { var setWinner = playSet.Play(); match.WinSet(s => setWinner); setScores.Add(new SetScore() { Score = match.PrintScore(), GameScores = playSet.GetGameScores() }); } if (match.State == MatchState.MatchWonBySideOne) { return(sideOne); } else { return(sideTwo); } }
public ITeam Play() { _match = new MatchService(); _setScores = new List <SetScore> { new SetScore { Score = _match.GetScore() } }; //play sets and find winner: it should be upto three sets while (_match.State != MatchState.MatchWonByTeamOne && _match.State != MatchState.MatchWonByTeamTwo) { var setWinner = _playSet.Play(); _match.Win(s => setWinner); _setScores.Add(new SetScore() { Score = _match.GetScore() , GameScores = _playSet.GetGameScores() }); } return(_match.State == MatchState.MatchWonByTeamOne ? TeamOne : TeamTwo); }