Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Binding]
public class WeatherHooks
{
private readonly IObjectContainer _objectContainer;
private const string AppSettingsFile = "appsettings.json";
public WeatherHooks(IObjectContainer objectContainer)
{
_objectContainer = objectContainer;
}
[BeforeScenario]
public async Task RegisterServices()
{
var factory = GetWebApplicationFactory();
await ClearData(factory);
_objectContainer.RegisterInstanceAs(factory);
var jsonFilesRepo = new JsonFilesRepository();
_objectContainer.RegisterInstanceAs(jsonFilesRepo);
var repository = (IWeatherRepository)factory.Services.GetService(typeof(IWeatherRepository))!;
_objectContainer.RegisterInstanceAs(repository);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment