示例#1
0
 public FromRPSGame()
 {
     InitializeComponent();
     rpsSvc = new RockPaperScissorsService();
     InitailControlProperty();
     cmbxGameType.SelectedIndex = 1;
 }
        public void When_ComputerChoice_RandomGenerator_NotNull()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            int result = rpsSvc.ComputerChoice();

            Assert.IsNotNull(result);
        }
        public void When_ComputerChoice_RandomGenerator_Called()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            int result = rpsSvc.ComputerChoice();

            Assert.AreNotEqual(result, 4);
        }
        public void WhenPlayerVsPlayes()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.ComputerVsComputer(2, 3);

            Assert.AreEqual(result, "Computer player 2 won!!!");
        }
        public void When_PlayerVsComputer_Given_InvalidChoice()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsComputer(2, 0);

            Assert.AreEqual(result, "Invalid choice, play gain.");
        }
        public void When_PlayerVsPlayer_Player2Won()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsPlayer(2, 3);

            Assert.AreEqual(result, "Player 2 won!!!");
        }
        public void When_ComputerVsPlayer_GameTie()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsComputer(1, 1);

            Assert.AreEqual(result, "Game tie!!!");
        }
        public void When_ComputerVsComputer_Player1Won()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.ComputerVsComputer(3, 2);

            Assert.AreEqual(result, "Computer player 1 won!!!");
        }
        public void When_ComputerVsPlayes_PlayerWon()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsComputer(2, 1);

            Assert.AreEqual(result, "You won!!!");
        }
        public void When_PlayerVsComputer_Returns_SomeResult()
        {
            RockPaperScissorsService rpsSvc = new RockPaperScissorsService();
            string result = rpsSvc.PlayerVsComputer(2, 0);

            Assert.IsNotNull(result);
        }