コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }