public static void Start() { IPlayer playerOne = SelectPlayerType("Player One"); IPlayer playerTwo = SelectPlayerType("Player Two"); Match match = new Match(playerOne, playerTwo); var matchResult = match.Start(); if (matchResult == MatchResult.PlayerOneWins) { Console.WriteLine("Player One won the match!"); } if (matchResult == MatchResult.PlayerTwoWins) { Console.WriteLine("Player Two won the match!"); } if (matchResult == MatchResult.Draw) { Console.WriteLine("It was a draw"); } Console.ReadKey(); }
public void PlayerTwoWinsTwoGamesAndMatch() { match = new RockPaperScissors.Match(mockPlayerOne.Object, mockPlayerTwo.Object); mockPlayerOne.SetupSequence(x => x.GetPlayerMove()) .Returns(Move.Scissors) .Returns(Move.Paper) .Returns(Move.Rock); mockPlayerTwo.SetupSequence(x => x.GetPlayerMove()) .Returns(Move.Rock) .Returns(Move.Rock) .Returns(Move.Paper); Assert.AreEqual(MatchResult.PlayerTwoWins, match.Start()); }
public void AllGamesDrawSoMatchIsADraw() { match = new RockPaperScissors.Match(mockPlayerOne.Object, mockPlayerTwo.Object); mockPlayerOne.SetupSequence(x => x.GetPlayerMove()) .Returns(Move.Rock) .Returns(Move.Paper) .Returns(Move.Scissors); mockPlayerTwo.SetupSequence(x => x.GetPlayerMove()) .Returns(Move.Rock) .Returns(Move.Paper) .Returns(Move.Scissors); Assert.AreEqual(MatchResult.Draw, match.Start()); }