public void DeleteTransactionDeletesTransaction()
        {
            int accountIdForTest = 1;

            //Arrange:
            // Instantiate TransactionsController so its methods can be called
            // Create a new transaction to be deleted, and get its transaction ID
            var transactionController = new TransactionsController();

            var transaction = new TransactionModel
            {
                AccountId = accountIdForTest,
                Amount = 3451.87M,
                TransactionDate = DateTime.Now
            };
            IHttpActionResult result =
                    transactionController.PostTransaction(transaction);
            CreatedAtRouteNegotiatedContentResult<TransactionModel> contentResult =
                (CreatedAtRouteNegotiatedContentResult<TransactionModel>)result;

            int transactionIdToDelete = contentResult.Content.TransactionId;

            //Act: Call DeleteTransaction
            result = transactionController.DeleteTransaction(transactionIdToDelete);

            //Assert:
            // Verify that HTTP result is OK
            // Verify that reading deleted transaction returns result not found
            Assert.IsInstanceOfType(result,
                typeof(OkNegotiatedContentResult<Transaction>));

            result = transactionController.GetTransaction(transactionIdToDelete);
            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
        public void PostTransactionCreatesTransaction()
        {
            int accountIdForTest = 1;

            //Arrange: Instantiate TransactionsController so its methods can be called
            var transactionController = new TransactionsController();

            //Act:
            // Create a TransactionModel object populated with test data,
            //  and call PostTransaction
            var newTransaction = new TransactionModel
            {
                AccountId = accountIdForTest,
                Amount = -555M,
                TransactionDate = DateTime.Now

            };
            IHttpActionResult result = transactionController.PostTransaction(newTransaction);

            //Assert:
            // Verify that the HTTP result is CreatedAtRouteNegotiatedContentResult
            // Verify that the HTTP result body contains a nonzero transaction ID
            Assert.IsInstanceOfType
                (result, typeof(CreatedAtRouteNegotiatedContentResult<TransactionModel>));
            CreatedAtRouteNegotiatedContentResult<TransactionModel> contentResult =
                (CreatedAtRouteNegotiatedContentResult<TransactionModel>)result;
            Assert.IsTrue(contentResult.Content.TransactionId != 0);

            // Delete the test transaction
            result = transactionController.DeleteTransaction(contentResult.Content.TransactionId);
        }
        [TestMethod] //{6}
        public void DeleteTransactionDeleteTransaction()
        {
            //Arrange
            //Create Controller
            var transactionsController = new TransactionsController();
            
            //Create a customer to be deleted
            var dbTransactions = new TransactionModel
            {
                Amount = 21323,
               
            };

            //Add 'new customer' to the DB using a POST
            //Save returned value as RESULT
            IHttpActionResult result = transactionsController.PostTransaction(dbTransactions);

            //Cast result as Content Result so that I can gather information from ContentResult
            CreatedAtRouteNegotiatedContentResult<TransactionModel> contentResult = (CreatedAtRouteNegotiatedContentResult<TransactionModel>)result;


            //Result contains the customer I had JUST created
            result = transactionsController.GetTransaction(1);

            //Get CustomerModel from 'result'
            OkNegotiatedContentResult<TransactionModel> customerResult = (OkNegotiatedContentResult<TransactionModel>)result;
            

            //Act
            //The result of the Delete Request
           IHttpActionResult second = transactionsController.DeleteTransaction(1);

            //Assert

            //If action returns: NotFound()
            Assert.IsNotInstanceOfType(second, typeof(NotFoundResult));

            Assert.IsInstanceOfType(second, typeof(OkNegotiatedContentResult<TransactionModel>));
        }