示例#1
0
        public void PlayerOnePaper_PlayerOneWins_False()
        {
            RPS newGame = new RPS();

            newGame.PlayerOnePaper("Scissors");
            int POS = newGame.GetPlayerOneScore();

            Assert.AreEqual(POS, 0);
        }
示例#2
0
        public void PlayerOnePaper_PlayerOneWins_True()
        {
            RPS newGame = new RPS();

            newGame.PlayerOnePaper("Rock");
            int POS = newGame.GetPlayerOneScore();

            Assert.AreEqual(POS, 1);
        }
        public ActionResult GameResult()
        {
            string POChoice = Request.Form["PlayerOne"];
            string PTChoice = Request.Form["PlayerTwo"];
            RPS    newGame  = new RPS();

            if (POChoice == "Rock")
            {
                newGame.PlayerOneRock(PTChoice);
            }
            else if (POChoice == "Paper")
            {
                newGame.PlayerOnePaper(PTChoice);
            }
            else if (POChoice == "Scissors")
            {
                newGame.PlayerOneScissors(PTChoice);
            }

            return(View("Index", newGame));
        }
        public ActionResult ComputerGameResult()
        {
            Random r = new Random();
            int    ComputerChoice = (r.Next(1, 3));
            string PTChoice       = Request.Form["PlayerSolo"];
            RPS    newGame        = new RPS();

            if (ComputerChoice == 1)
            {
                newGame.PlayerOneRock(PTChoice);
            }
            else if (ComputerChoice == 2)
            {
                newGame.PlayerOnePaper(PTChoice);
            }
            else if (ComputerChoice == 3)
            {
                newGame.PlayerOneScissors(PTChoice);
            }

            return(View("Index", newGame));
        }