示例#1
0
 public void PlayerOneScoresTwoTimes()
 {
     var board = new TennisBoard("X", "Y");
     board.Player1Scores();
     board.Player1Scores();
     Assert.AreEqual("30 - 0", board.Result);
 }
示例#2
0
 public void PlayerTwoScoresThreeTimes()
 {
     var board = new TennisBoard("X", "Y");
     board.Player2Scores();
     board.Player2Scores();
     board.Player2Scores();
     Assert.AreEqual("0 - 40", board.Result);
 }
示例#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");
        }
示例#4
0
 public void GameStartsInZero()
 {
     var board = new TennisBoard("X", "Y");
     Assert.AreEqual("0 - 0", board.Result);
 }
示例#5
0
 public void BoardTitleWithPlayerNames()
 {
     var board = new TennisBoard("Federer", "Nadal");
     Assert.AreEqual("Federer vs Nadal", board.Title);
 }
示例#6
0
 public void BoardTitleWithOtherPlayerNames()
 {
     var board = new TennisBoard("Rios", "Nalbandian");
     Assert.AreEqual("Rios vs Nalbandian", board.Title);
 }