public void DoctorActivityTest() { int DoctorID = 1; var doctor1Result = reportService.DoctorActivity(DoctorID); var doctorRecord = reportDao.PackageByUser(DoctorID, StockType.Distributed); int totalItems = 0; double totalValue = 0; foreach (Package pack in doctorRecord) { totalItems += pack.Medication.Quantity.Value; totalValue += pack.Medication.Value.Value * pack.Medication.Quantity.Value; } Assert.AreEqual(doctor1Result.TotalQuantity, totalItems); Assert.AreEqual(doctor1Result.TotalValue, totalValue); }
public ValueInTransitView DoctorActivity(int docID) { ICollection <Package> doctorRecord = reportDao.PackageByUser(docID, StockType.Distributed); ValueInTransitView GUIView = new ValueInTransitView(); int totalItems = 0; double totalValue = 0; foreach (Package pack in doctorRecord) { totalItems += pack.Medication.Quantity.Value; totalValue += pack.Medication.Value.Value * pack.Medication.Quantity.Value; } GUIView.Items = doctorRecord; GUIView.TotalQuantity = totalItems; GUIView.TotalValue = totalValue; return(GUIView); }