public async Task DeleteMedicationReturnsNoContentOnBadRequest() { var items = PopulateDatabaseWithItems(); var controller = new MedicationsController(CreateDatabase()); var result = await controller.DeleteMedication(-1); result.Should().BeOfType <NoContentResult>(); CreateDatabase().Medications.Should().BeEquivalentTo(items); }
public async Task DeleteMedicationRemovesItemOnGoodRequest() { var items = PopulateDatabaseWithItems(); var controller = new MedicationsController(CreateDatabase()); var result = await controller.DeleteMedication(items.First().Id); result.Should().BeOfType <NoContentResult>(); (await CreateDatabase().Medications.AnyAsync(m => m.Id == items.First().Id)).Should().BeFalse(); }