public void Get_by_id() { using (var context = new MyDbContext(_options)) { SetupDatabase(context); HospitalApp.Services.MedicationService service = new HospitalApp.Services.MedicationService(context); MedicationDto medication = service.GetById(2); medication.Id.ShouldBeEquivalentTo(2); } }
public void Get_all_medications() { using (var context = new MyDbContext(_options)) { SetupDatabase(context); HospitalApp.Services.MedicationService service = new HospitalApp.Services.MedicationService(context); List <MedicationDto> medications = service.GetAll(); medications.Count.ShouldBeGreaterThanOrEqualTo(2); } }
public void Add_medications_to_supply() { using (var context = new MyDbContext(_options)) { SetupDatabase(context); List <MedicationDto> newMeds = new List <MedicationDto>(); newMeds.Add(new MedicationDto() { Id = 1, Quantity = 5 }); HospitalApp.Services.MedicationService service = new HospitalApp.Services.MedicationService(context); List <MedicationDto> medications = service.AddMedicationsToSupply(newMeds); medications.ShouldNotBeNull(); } }