public async Task PostUKEeeData_ValidModel_SetsTriggerDownloadToTrue() { // Arrange ReportsController controller = new ReportsController( () => A.Dummy<IWeeeClient>(), A.Dummy<BreadcrumbService>()); ComplianceYearReportViewModel viewModel = new ComplianceYearReportViewModel(); // Act ActionResult result = await controller.UkEeeData(viewModel); // Assert ViewResult viewResult = result as ViewResult; Assert.NotNull(viewResult); Assert.Equal(true, viewResult.ViewBag.TriggerDownload); }
public async Task PostUkEeeData_ModelIsInvalid_SetsTriggerDownloadToFalse() { // Arrange ReportsController controller = new ReportsController( () => A.Dummy<IWeeeClient>(), A.Dummy<BreadcrumbService>()); ComplianceYearReportViewModel viewModel = new ComplianceYearReportViewModel(); // Act controller.ModelState.AddModelError("Key", "Error"); ActionResult result = await controller.UkEeeData(viewModel); // Assert ViewResult viewResult = result as ViewResult; Assert.NotNull(viewResult); Assert.Equal(false, viewResult.ViewBag.TriggerDownload); }
public async Task<ActionResult> SchemeObligationData(ComplianceYearReportViewModel model) { SetBreadcrumb(); ViewBag.TriggerDownload = ModelState.IsValid; await PopulateFilters(model); return View(model); }
private async Task PopulateFilters(ComplianceYearReportViewModel model) { List<int> years = await FetchComplianceYearsForDataReturns(); model.ComplianceYears = new SelectList(years); }
public async Task<ActionResult> SchemeObligationData() { SetBreadcrumb(); ViewBag.TriggerDownload = false; ComplianceYearReportViewModel model = new ComplianceYearReportViewModel(); await PopulateFilters(model); return View("SchemeObligationData", model); }