Created
January 28, 2022 12:39
-
-
Save tonysneed/f3410cc8a9369c7c0653758dd0bffd79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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