public void GetTransactionsReturnsTransactions() { //Arrange: Instantiate TransactionsController so its methods can be called var transactionController = new TransactionsController(); //Act: Call the GetTransactions method IEnumerable<TransactionModel> transactions = transactionController.GetTransactions(); //Assert: Verify that an array was returned with at least one element Assert.IsTrue(transactions.Count() > 0); }
[TestMethod] //{1} public void GetTransactionsReturnTransactions() { //Arrange var transactionsController = new TransactionsController(); //Act IQueryable<TransactionModel> results = transactionsController.GetTransactions(); //Assert (if true, pass) Assert.IsTrue(results.Count() > 0); }
[TestMethod] //{3} public void GetAllTransactionsForAccountIdReturnTransactions() { //arrange var transactionsController = new TransactionsController(); //act IHttpActionResult result = transactionsController.GetTransactions(1); //assert Assert.IsNotInstanceOfType(result, typeof(NotFoundResult)); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<IQueryable<TransactionModel>>)); }