Ejemplo n.º 1
0
 public void PlayerOneScoresTwoTimes()
 {
     var board = new TennisBoard("X", "Y");
     board.Player1Scores();
     board.Player1Scores();
     Assert.AreEqual("30 - 0", board.Result);
 }
Ejemplo n.º 2
0
 public void PlayerTwoScoresThreeTimes()
 {
     var board = new TennisBoard("X", "Y");
     board.Player2Scores();
     board.Player2Scores();
     board.Player2Scores();
     Assert.AreEqual("0 - 40", board.Result);
 }
Ejemplo n.º 3
0
        public ViewResult Start(string player1, string player2)
        {
            if (String.IsNullOrWhiteSpace(player1))
            {
                ViewBag.ErrorMessage = "You should input a name for the first player";
                return View("Index");
            }
            if (String.IsNullOrWhiteSpace(player2))
            {
                ViewBag.ErrorMessage = "You should input a name for the second player";
                return View("Index");
            }

            var board = new TennisBoard(player1, player2);
            _sessionStore["Game"] = board;

            ViewBag.Title = board.Title;
            ViewBag.Result = board.Result;

            return View("Game");
        }
Ejemplo n.º 4
0
 public void GameStartsInZero()
 {
     var board = new TennisBoard("X", "Y");
     Assert.AreEqual("0 - 0", board.Result);
 }
Ejemplo n.º 5
0
 public void BoardTitleWithPlayerNames()
 {
     var board = new TennisBoard("Federer", "Nadal");
     Assert.AreEqual("Federer vs Nadal", board.Title);
 }
Ejemplo n.º 6
0
 public void BoardTitleWithOtherPlayerNames()
 {
     var board = new TennisBoard("Rios", "Nalbandian");
     Assert.AreEqual("Rios vs Nalbandian", board.Title);
 }