[Enter feedback here]
First of all, thanks for this documentation, I was able to almost test one middle ware.
However, I was trying to write unit tests for another one which uses DataContext or is DI injested in the Invoke method. The DataContext is however resolved, but the model say Blog does not have any data entries in it. I am assuming this to be the case as I am using the UseTestServer() in the beginning.
Is there a way or any alternative way as well of injesting data to the DataContext so that the middleware can be tested?
Description
[Enter feedback here] First of all, thanks for this documentation, I was able to almost test one middle ware.
However, I was trying to write unit tests for another one which uses
DataContext
or is DI injested in theInvoke
method. TheDataContext
is however resolved, but the model sayBlog
does not have any data entries in it. I am assuming this to be the case as I am using theUseTestServer()
in the beginning.Is there a way or any alternative way as well of injesting data to the
DataContext
so that the middleware can be tested?Page URL
https://learn.microsoft.com/en-us/aspnet/core/test/middleware?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/test/middleware.md
Document ID
8415adee-793e-2ba7-b97b-672b493ba42b
Article author
@Tratcher