Beispiel #1
0
        public Game()
        {
            Get["/"] = _ =>{
            return View["index.cshtml"];
              };

              Get["/play1"] = _ =>{
            return View["play1.cshtml"];
              };

              Post["/player_1_input"] = _ => {
            Player player1 = new Player(Request.Form["input1"]);
            player1.Save();
            return View["play2.cshtml"];
              };
              Post["/player_2_input"] = _ =>{
            Player player2 = new Player(Request.Form["input2"]);
            player2.Save();
            return View["ready.cshtml"];
              };
              Get["/who_wins"] = _ =>{
            List<Player>allPlays = new Player.GetAll();
            return View["/result.cshtml", allPlays];
              };
        }
Beispiel #2
0
        public Game()
        {
            Get["/"] = _ =>{
            return View["index.cshtml"];
              };

              Get["/player1"] = _ =>{
            return View["player1.cshtml"];
              };

              Post["/player_1_input"] = _ => {
            Player player1 = new Player(Request.Form["input1"]);
            player1.Save();
            return View["player2.cshtml"];
              };
        }
Beispiel #3
0
        public void Test_PlayAGame_SciBeatPap_true()
        {
            //Arrange
              Player player1 = new Player("Scissors");
              player1.Save();
              Player player2 = new Player("Paper");
              player2.Save();

              //Act
              //write a method to determine the winner
              string result = Player.Shoot(player1, player2);
              //Assert
              Console.WriteLine(player1);
              Console.WriteLine(player2);

              Assert.Equal("PLAYER 1 WINS", result);
        }
Beispiel #4
0
        public void Test_PlayAGame_DRAW_true()
        {
            //Arrange
              Player player1 = new Player("Rock");
              player1.Save();
              Player player2 = new Player("Rock");
              player2.Save();

              //Act
              //write a method to determine the winner
              string result = Player.Shoot(player1, player2);
              //Assert
              Console.WriteLine(player1);
              Console.WriteLine(player2);

              Assert.Equal("DRAW", result);
        }
Beispiel #5
0
        public void Test_PlayerSave_true()
        {
            //Arrange
              Player player1 = new Player("Rock");
              player1.Save();

              //Act
              List<Player> allPlayers = Player.GetAll();

              //Assert
              Assert.Equal(player1, allPlayers[0]);
        }
Beispiel #6
0
        public void Test_TwoPlayersSave_true()
        {
            //Arrange
              Player player1 = new Player("Rock");
              player1.Save();
              Player player2 = new Player("Paper");
              player2.Save();

              //Act
              List<Player> allPlayers = Player.GetAll();

              //Assert
              // Console.WriteLine(new List<Player>() {player1, player2});
              Console.WriteLine(allPlayers.Count);
              Assert.Equal(player1, allPlayers[0]);
              Assert.Equal(player2, allPlayers[1]);
        }