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_Returns_View_ViewReports() { const string expectedViewName = "ViewReports"; SupervisorController controller = new SupervisorController(mockEmployeeService, mockReportService, mockEmployee, mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result = controller.ViewReports() as ViewResult; Assert.AreEqual(expectedViewName, result.ViewName, "View names do not match, expected view name is{0}", expectedViewName); }
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 ViewReports_Returns_ActionResult() { SupervisorController controller=new SupervisorController(mockEmployeeService,mockReportService,mockEmployee,mockBudgetService); MockHttpContext.SetFakeHttpContext(controller); var result=controller.ViewReports(); Assert.IsInstanceOfType(result,typeof(ActionResult),"Result is not of ActionResult type"); }
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>)); }