Contradictory docs on required with property injection and TestWebApplicationFactory
#5773
-
|
Property injection reads (emphasis mine):
The examples in ASP.NET Core Integration Testing, section Container Integration show a contradictory pattern though: public class WebApplicationFactory : TestWebApplicationFactory<Program>
{
[ClassDataSource<InMemoryDatabase>(Shared = SharedType.PerTestSession)]
public InMemoryDatabase Database { get; init; } = null!;Further, if one wants to use such factory with a test base, e.g. public abstract class EfCoreTodoTestBase : WebApplicationTest<EfCoreWebApplicationFactory, Program>the Just not declaring the parameter |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yeah - It works without - because I had to support the scenario you mentioned. Probably worth a docs update. Required is preferred if possible because it removes nullability warnings - but some scenarios don't permit it |
Beta Was this translation helpful? Give feedback.
Yeah - It works without - because I had to support the scenario you mentioned. Probably worth a docs update.
Required is preferred if possible because it removes nullability warnings - but some scenarios don't permit it