public void DeletingAnInexistingGameIdMustRaiseException() { // Given IBoringToeRepository repo = new BoringToeSetRepository(); // When / Then NotExistingValueException excep = Assert.Throws <NotExistingValueException>(() => repo.DeleteGame(1), "Deleting 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 DeletingANonExistingElementMustRaiseException() { // Given MockRepository rep = new MockRepository(); // When / Then NotExistingValueException exc = Assert.Throws <NotExistingValueException>(() => rep.Delete(1), "Deleting inexistent data must raise exception"); Assert.AreEqual(exc.ErrorCode, ErrorCode.VALUE_NOT_EXISTING_IN_DATABASE, "Raised exception code must be VALUE_NOT_EXISTING_IN_DATABASE"); }
public void GettingAnInexistingPlayerGuidMustRaiseException() { // Given IPlayerRepository repo = new PlayerSetRepository(); // When / Then NotExistingValueException excep = Assert.Throws <NotExistingValueException>(() => repo.GetPlayerByGuid(Guid.NewGuid()), "Getting an inexisting player 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 DeletingAnElementMustRaiseAnExceptionIdTryingToDeleteAgain() { // Given MockRepository rep = new MockRepository(); MockClass data = new MockClass(); long resp = (long)rep.Add(data); // When rep.Delete(resp); //Then NotExistingValueException exc = Assert.Throws <NotExistingValueException>(() => rep.Delete(resp), "Deleting already deleted data must raise exception"); Assert.AreEqual(exc.ErrorCode, ErrorCode.VALUE_NOT_EXISTING_IN_DATABASE, "Raised exception code must be VALUE_NOT_EXISTING_IN_DATABASE"); }
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 GettingADeletedPlayerMustRaiseException() { // Given IPlayerRepository repo = new PlayerSetRepository(); Player player = new Player("TestPlayer"); long id; // When id = repo.AddPlayer(player); repo.DeletePlayer(id); // When / Then NotExistingValueException excep = Assert.Throws <NotExistingValueException>(() => repo.GetPlayerById(id), "Getting an inexisting player must raise an exception"); Assert.AreEqual(excep.ErrorCode, ErrorCode.VALUE_NOT_EXISTING_IN_DATABASE, "Error code must be VALUE_NOT_EXISTING_IN_DATABASE"); }