public void CanArrivalsVsReceiptsReport() { //ACT //TODO: Seed data into ArrivalsVsReceiptsViewModel before proceding with testing var viewModel = new ArrivalsVsReceiptsViewModel {}; var viewResult = _stockManagementController.ArrivalsVsReceiptsReport(viewModel) as ViewResult; //ASSERT Assert.NotNull(viewResult); Assert.IsInstanceOf<IEnumerable<Program>>(viewResult.ViewBag.Program); Assert.IsInstanceOf<IEnumerable<CommodityType>>(viewResult.ViewBag.CommodityTypes); Assert.IsInstanceOf<IEnumerable<CommoditySource>>(viewResult.ViewBag.CommoditySources); }
/// <summary> /// Show the ETA, MT Expected, MT + % that has arrived, MT + % still to arrive /// </summary> /// <returns></returns> public ActionResult ArrivalsVsReceipts() { var user = _userProfileService.GetUser(User.Identity.Name); var commoditySourceViewModels = _commoditySourceService.GetAllCommoditySourceForReport(); var portViewModels = _receiveService.GetALlPorts(); var codesViewModels = ConstantsService.GetAllCodes(); var commodityTypeViewModels = _commodityTypeService.GetAllCommodityTypeForReprot(); var programViewModels = _programService.GetAllProgramsForReport(); var viewModel = new ArrivalsVsReceiptsViewModel(commoditySourceViewModels, portViewModels, codesViewModels, commodityTypeViewModels, programViewModels, user); return View(viewModel); }
public ActionResult ArrivalsVsReceiptsReport(ArrivalsVsReceiptsViewModel viewModel) { ViewBag.Program = viewModel.ProgramId == null ? "All" : _programService.GetAllProgram().Where(c => c.ProgramID == viewModel.ProgramId).Select(c => c.Name).Single(); ViewBag.CommodityTypes = viewModel.CommodityTypeId == 0 ? "All" : _commodityTypeService.GetAllCommodityType().Where(c => c.CommodityTypeID == viewModel.CommodityTypeId).Select(c => c.Name).Single(); ViewBag.CommoditySources = viewModel.CommoditySourceId == 0 ? "All" : _commoditySourceService.GetAllCommoditySource().Where(c => c.CommoditySourceID == viewModel.CommoditySourceId).Select(c => c.Name).Single(); return PartialView(); }