Example #1
0
        public void WhenPlayerWeaponIsSameAsComputerWeapon_ItShouldReturnDraw(Weapon playerWeapon, Weapon computerWeapon)
        {
            var expected = Weapon.None;

            var result = subject.Fight(playerWeapon, computerWeapon);

            Assert.Equal(expected, result);
        }
Example #2
0
        public GameResult Play(string input)
        {
            Weapon computerWeapon = GetRandomWeapon();
            Weapon playerWeapon   = ConvertToWeapon(input);

            RockPaperScissorsRules game = new RockPaperScissorsRules();

            var winningWeapon = game.Fight(playerWeapon, computerWeapon);

            if (winningWeapon == Weapon.None)
            {
                return(GameResult.Draw);
            }
            else if (winningWeapon == computerWeapon)
            {
                ComputerScore++;
                return(GameResult.Lose);
            }
            else
            {
                PlayerScore++;
                return(GameResult.Win);
            }
        }