public void AddMedicationTest() { testmedi = new Medication(); testmedi.Description = "test"; testmedi.Value = 99999; medicationService.AddMedication(testmedi); var medi = medicationDao.Medications.SingleOrDefault(Medication => Medication.Description == "test"); double? testValue = medi.Value; int mediID = medi.MedicalID; var temp = medicationDao.Medications.SingleOrDefault(Medication => Medication.MedicalID == mediID); medicationDao.Medications.Remove(temp); medicationDao.SaveChanges(); Assert.AreEqual(testValue, testmedi.Value); }
public bool AddMedication(Medication med) { medicationDao.RegisterMedication(med); return true; }
public bool RegisterMedication(Medication med) { Medications.Add(med); SaveChanges(); return true; }
public ActionResult RegisterMedication(Medication med) { medicationService.AddMedication(med); return View(); }
public void GetMedicationTest() { testmedi = new Medication(); testmedi.Description = "test"; testmedi.Value = 99999; medicationDao.RegisterMedication(testmedi); int mediID = medicationDao.Medications.SingleOrDefault(Medication => Medication.Description == "test").MedicalID; var result = medicationDao.GetMedication(mediID).Description; var me = medicationDao.Medications.SingleOrDefault(Medication => Medication.Description == "test"); medicationDao.Medications.Remove(me); medicationDao.SaveChanges(); Assert.AreEqual(result, "test"); }
public void GetShellLifeTest() { testmedi = new Medication(); testmedi.Description = "test"; testmedi.Shell_Life = 99; medicationDao.RegisterMedication(testmedi); int mediID = medicationDao.Medications.SingleOrDefault(Medication => Medication.Description == "test").MedicalID; DateTime result = medicationService.GetShellLifeInDays(mediID); var me = medicationDao.Medications.SingleOrDefault(Medication => Medication.Description == "test"); medicationDao.Medications.Remove(me); medicationDao.SaveChanges(); var test = DateTime.Today.AddDays(99); Assert.AreEqual(result, test); }