We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what is the proper way of injecting this within a test case? ASP Core 7.0
public class IndexModel : PageModel { private readonly DbContext _context; private readonly IConfiguration _configuration; private readonly IToastNotification _toastNotification; public IndexModel(DbContext context, IConfiguration configuration, IToastNotification toastNotification) { _context = context; _configuration = configuration; _toastNotification = toastNotification; } ... ... ... } public class Tests { private readonly HttpClient _httpClient; private readonly DbContext _context; private readonly IConfiguration _configuration; private readonly IToastNotification _toastNotification; ?? public Tests() { var webAppFactory = new WebApplicationFactory<Program>(); var scope = webAppFactory.Services.CreateScope(); var scopedServices = scope.ServiceProvider; _httpClient = webAppFactory.CreateDefaultClient(); _context = scopedServices.GetRequiredService<DbContext>(); _configuration = scopedServices.GetRequiredService(typeof(IConfiguration)) as IConfiguration; } [Fact, Priority(1)] public async Task OnPostAddSectionAsyncTest() { var indexModel= new IndexModel(_context, _configuration, ???); } ... ... ... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
what is the proper way of injecting this within a test case? ASP Core 7.0
The text was updated successfully, but these errors were encountered: