示例#1
0
        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);
        }
示例#2
0
        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();
        }