public async Task DeleteApiResourceAsync() { using (var context = new ConfigurationDbContext(_dbContextOptions, _storeOptions, _operationalStore)) { IApiResourceRepository apiResourceRepository = new ApiResourceRepository(context); //Generate random new api resource var apiResource = ApiResourceMock.GenerateRandomApiResource(0); //Add new api resource await apiResourceRepository.AddApiResourceAsync(apiResource); //Get new api resource var newApiResource = await context.ApiResources.Where(x => x.Id == apiResource.Id).SingleAsync(); //Assert new api resource newApiResource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); //Delete api resource await apiResourceRepository.DeleteApiResourceAsync(newApiResource); //Get deleted api resource var deletedApiResource = await context.ApiResources.Where(x => x.Id == apiResource.Id).SingleOrDefaultAsync(); //Assert if it not exist deletedApiResource.Should().BeNull(); } }