Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created January 28, 2022 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysneed/a22f0294aaa6472d9433db1c3a529933 to your computer and use it in GitHub Desktop.
Save tonysneed/a22f0294aaa6472d9433db1c3a529933 to your computer and use it in GitHub Desktop.
private async Task ClearData(
WebApplicationFactory<Program> factory)
{
if (factory.Services.GetService(typeof(IWeatherRepository))
is not IWeatherRepository repository) return;
var entities = await repository.GetAsync();
foreach (var entity in entities)
await repository.RemoveAsync(entity.Id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment