public void StartTournament() { var NextGroup = new List <Player>(); while (Player.Count % 2 == 0) { Player firstPlayer; Player secondPlayer; for (int i = 0; i < Player.Count; i += 2) { firstPlayer = Player[i]; secondPlayer = Player[(i + 1)]; HandSign.ValidateRound(firstPlayer, secondPlayer); var winner = HandSign.GetWinner(firstPlayer, secondPlayer); NextGroup.Add(winner); } Player.Clear(); Player.AddRange(NextGroup); NextGroup.Clear(); } Console.WriteLine("**************************************************************************************************"); Console.WriteLine($"Congratulations {Player.First().Name}, you were the winner of the paper rock scissors tournament!!!!!"); }
public void GetWinnerTest_Draw_Pass() { //Assign Player player1 = new Player("Player1") { HandSign = new HandSign(HandSign.Move.Rock) }; Player player2 = new Player("Player2") { HandSign = new HandSign(HandSign.Move.Rock) }; var expectedResult = "Draw"; //Act var result = HandSign.GetWinner(player1, player2); //Assert Assert.AreSame(expectedResult, result); }
public void GetWinnerTest_Player1_Pass() { //Assign Player player1 = new Player("Player1") { HandSign = new HandSign(HandSign.Move.Scissors) }; Player player2 = new Player("Player2") { HandSign = new HandSign(HandSign.Move.Paper) }; var expectedResult = "Player1"; //Act var result = HandSign.GetWinner(player1, player2); //Assert Assert.AreSame(expectedResult, result); }