public async Task Test_GetAllExpensesByUserId_Fail_BadRequest() { var controller = new BudgetExpensesController(_expensesServices.Object); var response = await controller.GetExpensesByUserId(0); Assert.NotNull(response); Assert.AreEqual(400, ((ObjectResult)response).StatusCode); }
public async Task Test_GetAllExpensesByUserId_Fail_NullEntry() { _expensesServices.Setup(e => e.GetExpensesByUserId(It.IsAny <long>())) .ThrowsAsync(new ArgumentException("Null Entry")); var controller = new BudgetExpensesController(_expensesServices.Object); var response = await controller.GetExpensesByUserId(1); Assert.NotNull(response); Assert.AreEqual(400, ((ObjectResult)response).StatusCode); }
public async Task Test_GetAllExpensesByUserId_Success() { _expensesServices.Setup(e => e.GetExpensesByUserId(It.IsAny <long>())) .ReturnsAsync(new List <BudgetExpensesModel>()); var controller = new BudgetExpensesController(_expensesServices.Object); var response = await controller.GetExpensesByUserId(1); Assert.NotNull(response); Assert.AreEqual(200, ((ObjectResult)response).StatusCode); }
public async Task Test_GetAllExpensesByUserId_InternalServerError() { _expensesServices.Setup(e => e.GetExpensesByUserId(It.IsAny <long>())) .ThrowsAsync(new Exception("Exception")); var controller = new BudgetExpensesController(_expensesServices.Object); var response = await controller.GetExpensesByUserId(1); Assert.NotNull(response); Assert.AreEqual(500, ((ObjectResult)response).StatusCode); }