Exemplo n.º 1
0
 public HomeModule()
 {
     Get["/"] = _ => {
         return(View["index.cshtml"]);
     };
     Post["/"] = _ => {
         string        player1Input = Request.Form["player1"];
         string        player2Input = Request.Form["player2"];
         RPS           newRPS       = new RPS(player1Input, player2Input);
         List <string> newResults   = newRPS.GameMethod();
         return(View["index.cshtml", newResults]);
     };
 }
Exemplo n.º 2
0
        public void ReturnPlayerTwoWins_ForTwoEntriesDiff_PlayerTwoWins()
        {
            //arrange
            string player1Input = "scissors";
            string player2Input = "rock";

            RPS testRPS = new RPS(player1Input, player2Input);

            //act
            List <string> output = testRPS.GameMethod();

            //assert
            List <string> newRPS = new List <string> {
            };

            newRPS.Add("scissors");
            newRPS.Add("rock");
            newRPS.Add("Player 2 wins!");

            Assert.Equal(newRPS, output);
        }
Exemplo n.º 3
0
        public void ReturnTie_ForTwoEntriesSame_Tie()
        {
            //arrange
            string player1Input = "rock";
            string player2Input = "rock";

            RPS testRPS = new RPS(player1Input, player2Input);

            //act
            List <string> output = testRPS.GameMethod();

            //assert
            List <string> newRPS = new List <string> {
            };

            newRPS.Add("rock");
            newRPS.Add("rock");
            newRPS.Add("It's a tie");

            Assert.Equal(newRPS, output);
        }