public void AfterAddingAGameItMustBeAccessableById() { // Given IBoringToeRepository repo = new BoringToeSetRepository(); long id; ITicTacToe game = new TicTacToeImpl(); ITicTacToe testGame; // When id = repo.AddGame(game); testGame = repo.GetGameById(id); // Then Assert.AreEqual(game, testGame, "Returned game must be the same as added one"); }
public void GettingADeletedGameMustRaiseException() { // Given IBoringToeRepository repo = new BoringToeSetRepository(); TicTacToeImpl TicTacToe = new TicTacToeImpl(); long id; // When id = repo.AddGame(TicTacToe); repo.DeleteGame(id); // When / Then NotExistingValueException excep = Assert.Throws <NotExistingValueException>(() => repo.GetGameById(id), "Getting an inexisting game must raise an exception"); Assert.AreEqual(excep.ErrorCode, ErrorCode.VALUE_NOT_EXISTING_IN_DATABASE, "Error code must be VALUE_NOT_EXISTING_IN_DATABASE"); }
public void GettingAnInexistingGameIdMustRaiseException() { // Given IBoringToeRepository repo = new BoringToeSetRepository(); // When / Then NotExistingValueException excep = Assert.Throws <NotExistingValueException>(() => repo.GetGameById(1), "Getting an inexisting game must raise an exception"); Assert.AreEqual(excep.ErrorCode, ErrorCode.VALUE_NOT_EXISTING_IN_DATABASE, "Error code must be VALUE_NOT_EXISTING_IN_DATABASE"); }