public void CheckBalance_ViewData_IsBudget() { SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.CheckBalance() as ViewResult; Assert.IsInstanceOfType(result.ViewData.Model, typeof(Budget)); }
public void ApproveExpenses_ViewData_IsApproveExpensesViewModel() { SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ApproveExpenses() as ViewResult; Assert.IsInstanceOfType(result.ViewData.Model, typeof(ApproveExpensesViewModel)); }
public void ApproveExpenses_Returns_ActionResult() { SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ApproveExpenses(); Assert.IsInstanceOfType(result, typeof(ActionResult), "Result is not of ActionResult type"); }
public void CheckBalance_Returns_View_CheckBalance() { const string expectedViewName = "CheckBalance"; SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.CheckBalance() as ViewResult; Assert.AreEqual(expectedViewName, result.ViewName, "View names do not match, expected view name is{0}", expectedViewName); }
public void HttpPost_ViewReports_CheckStatusOfReportAndStatusPassed_AreEqual() { Employee mockEmployee = mockEmployeeService.GetEmployee(1); SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports(ReportStatus.Submitted.ToString()) as ViewResult; var ExpenseReports = (List<ExpenseReport>)result.Model; foreach (var report in ExpenseReports) { Assert.AreEqual(ReportStatus.Submitted.ToString(), report.Status); } }
public void ViewReports_ReportsAreDisplayedForCurrentMonthOfCurrentYear_IsTrue() { Employee mockEmployee = mockEmployeeService.GetEmployee(1); int month = DateTime.Now.Month; int year = DateTime.Now.Year; SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports(ReportStatus.Submitted.ToString()) as ViewResult; var ExpenseReports = (List<ExpenseReport>)result.Model; foreach (var report in ExpenseReports) { Assert.IsTrue(month == report.CreateDate.Value.Month); Assert.IsTrue(year == report.CreateDate.Value.Year); } }
public void HttpPost_ViewReports_ViewData_IsListOfExpenseReports() { SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports(ReportStatus.Submitted.ToString()) as ViewResult; Assert.IsInstanceOfType(result.ViewData.Model, typeof(List<ExpenseReport>)); }
public void HttpPost_ViewReports_Returns_View_ViewReports() { const string expectedViewName = "ViewReports"; SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports(ReportStatus.Submitted.ToString()) as ViewResult; Assert.AreEqual(expectedViewName, result.ViewName, "View names do not match, expected view name is{0}", expectedViewName); }
public void HttpPost_ViewReports_Returns_ActionResult() { SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports(ReportStatus.Submitted.ToString()); Assert.IsInstanceOfType(result, typeof(ActionResult), "Result is not of ActionResult type"); }