public void When_PlayerVsPlayer_Player2Won()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsPlayer(2, 3);

            Assert.AreEqual(result, "Player 2 won!!!");
        }
        public void When_PlayerVsPlayer_Returns_SomeResult()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsPlayer(2, 0);

            Assert.IsNotNull(result);
        }
        public void When_PlayerVsPlayer_GameTie()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsPlayer(1, 1);

            Assert.AreEqual(result, "Game tie!!!");
        }
        public void When_PlayerVsPlayer_Given_InvalidChoice()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsPlayer(2, 0);

            Assert.AreEqual(result, "Invalid choice, play gain.");
        }
Пример #5
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     if (cmbxGameType.SelectedItem.ToString().Equals(PVSC))
     {
         txtResult.Text = rpsSvc.PlayerVsComputer(Convert.ToInt32(cmbPlayer1.SelectedItem.ToString()), Convert.ToInt32(txtCompChoice2.Text));
     }
     else if (cmbxGameType.SelectedItem.ToString().Equals(PVSP))
     {
         txtResult.Text = rpsSvc.PlayerVsPlayer(Convert.ToInt32(cmbPlayer1.SelectedItem.ToString()), Convert.ToInt32(cmbPlayer2.SelectedItem.ToString()));
     }
     else if (cmbxGameType.SelectedItem.ToString().Equals(CVSC))
     {
         txtResult.Text = rpsSvc.ComputerVsComputer(Convert.ToInt32(txtCompChoice1.Text), Convert.ToInt32(txtCompChoice2.Text));
     }
 }