public void GetTransaction_ShouldNotFindTransaction()
        {
            var context = new TestTransactionContext();
              context.Transactions.Add(new Transaction { TransactionId = 1, Description = "Demo1", TransactionAmount = 1.23M });
              context.Transactions.Add(new Transaction { TransactionId = 2, Description = "Demo2", TransactionAmount = 2.34M });
              context.Transactions.Add(new Transaction { TransactionId = 3, Description = "Demo3", TransactionAmount = 34.45M });
              context.Transactions.Add(new Transaction { TransactionId = 4, Description = "Demo4", TransactionAmount = 456.78M });
              var controller = new TransactionsController(context);

              try
              {
            var result = controller.GetTransaction(999);
              }
              catch (HttpResponseException ex)
              {
            Assert.AreEqual(ex.Response.StatusCode, HttpStatusCode.BadRequest, "Transaction not found");
              }
        }
 public ActionResult Edit(int id)
 {
     TransactionsController tc = new TransactionsController(db);
       var result = tc.GetTransaction(id) as OkNegotiatedContentResult<Transaction>;
       return View(result.Content);
 }
        public void GetTransaction_ShouldReturnTransactionWithSameID()
        {
            var context = new TestTransactionContext();
              context.Transactions.Add(new Transaction { TransactionId = 1, Description = "Demo1", TransactionAmount = 1.23M });

              var controller = new TransactionsController(context);
              var result = controller.GetTransaction(1) as OkNegotiatedContentResult<Transaction>;

              Assert.IsNotNull(result);
              Assert.AreEqual(1, result.Content.TransactionId);
        }