コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        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>));
        }