public void Get_ShouldNotFindTransaction() { TransactionRepository repo = new TransactionRepository(); var transactionController = new TransactionsController(repo); var result = transactionController.Get(-1); Assert.That(result, Is.TypeOf<NotFoundResult>()); }
public void Get_ReturnsListOfTransactions() { TransactionRepository repo = new TransactionRepository(); var transactionController = new TransactionsController(repo); IHttpActionResult result = transactionController.Get(); Assert.That(result, Is.TypeOf<OkNegotiatedContentResult<IEnumerable<Transaction>>>()); var okResult = result as OkNegotiatedContentResult<IEnumerable<Transaction>>; Assert.That(repo.Get().Count(), Is.EqualTo(okResult.Content.Count())); }