public void CenterStockServiceTest() { int centerID = 1; var stockView = reportService.GenerateDistributionCenterStock(centerID); var stockReport = reportDao.DistributionCenterStock(centerID); int numOfMediTest = stockView.Items.Count(); int numOfMediResult = stockReport.Count(); Assert.AreEqual(numOfMediTest, numOfMediResult); }
public DistributionCenterStockGUIView GenerateDistributionCenterStock(int centerID) { ICollection <DistributionCenterStockView> stockReport = reportDao.DistributionCenterStock(centerID); DistributionCenterStockGUIView GUIView = new DistributionCenterStockGUIView(); int totalItems = 0; double totalValue = 0; foreach (DistributionCenterStockView item in stockReport) { Medication med = medicationDao.GetMedication(item.ItemID); item.ItemName = med.Description; item.Total = (item.Quantity * med.Value.Value); totalItems += item.Quantity; totalValue += item.Total; } GUIView.Items = stockReport; GUIView.TotalQuantity = totalItems; GUIView.TotalValue = totalValue; return(GUIView); }