public void Love_All() { var gameId = 1; GivenPlayerScore(gameId, 0, 0); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Love All", gameId); }
public void Deuce() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 3, SecondPlayerScore = 3 }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Deuce", gameId); }
public void Fifteen_All() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 1, SecondPlayerScore = 1 }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Fifteen All", gameId); }
public void Love_Fifteen() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 0, SecondPlayerScore = 1 }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Love Fifteen", gameId); }
public void Thirty_Love() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 2, SecondPlayerScore = 0 }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Thirty Love", gameId); }
public void Joey_Win_with_4_0() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 4, SecondPlayerScore = 0, FirstPlayName = "Joey", SecondPlayerName = "Tom" }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Joey Win", gameId); }
public void Tom_Win() { var gameId = 1; repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 3, SecondPlayerScore = 5, FirstPlayName = "Joey", SecondPlayerName = "Tom" }); TennisGame tennisGame = new TennisGame(repo); ScoreShouldBe("Tom Win", gameId); }
public void TestBase(Game game, string check) { IRepository <Game> repo = Substitute.For <IRepository <Game> >(); repo.GetGame(game.Id).Returns(game); TennisGame tennisGame = new TennisGame(repo); var scoreResult = tennisGame.ScoreResult(game.Id); Assert.AreEqual(check, scoreResult); }
public void Love_All() { var gameId = 91; IRepository <Game> repo = Substitute.For <IRepository <Game> >(); repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 0, SecondPlayerScore = 0 }); TennisGame tennisGame = new TennisGame(repo); var scoreResult = tennisGame.ScoreResult(gameId); Assert.AreEqual("Love All", scoreResult); }
public void Adv() { var gameId = 1; IRepository <Game> repo = Substitute.For <IRepository <Game> >(); repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = 4, SecondPlayerScore = 3, FirstPlayerName = "Joey", SecondPlayerName = "Tom" }); TennisGame tennisGame = new TennisGame(repo); var scoreResult = tennisGame.ScoreResult(gameId); Assert.AreEqual("Joey Adv", scoreResult); }
public void TennisScore_Test_第一人分數_第二人分數_預期結果(int firstPlayerScore, int secondPlayerScore, string result) { var firstPlayer = "Joey"; var sencondPlayer = "Tom"; var gameId = 1; IRepository <Game> repo = Substitute.For <IRepository <Game> >(); repo.GetGame(gameId).Returns(new Game { Id = gameId, FirstPlayerScore = firstPlayerScore, SecondPlayerScore = secondPlayerScore, FirstPlayerName = firstPlayer, SecondPlayerName = sencondPlayer }); TennisGame tennisGame = new TennisGame(repo); var scoreResult = tennisGame.ScoreResult(gameId); Assert.AreEqual(result?.ToLower(), scoreResult?.ToLower()); }
public void TestInit() { _tennisGame = new TennisGame(_repository); }
public void start() { tennisGame = new TennisGame(repo); }
private void ScoreShouldBe(string expected, int id) { TennisGame tennisGame = new TennisGame(repo); Assert.AreEqual(expected, tennisGame.ScoreResult(id)); }