IClassFixture with WebApplicationFactory and one time test setup #2865
-
I have some data that I would like to fetch once when the test class is created. I've read some of the docs but I'm struggling how to do this correctly in my situation. The docs say that I should create a class fixture and implement IDisposable, but how do I do that and also use WebApplicationFactory ? I want to use WebApplicationFactory so that I can access some settings from the appsettings.json file in my tests. my test class looks like this
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
https://xunit.net/docs/shared-context shows how you write a fixture (the init logic lives in the fixture, not where you have the logic in the ctor) |
Beta Was this translation helpful? Give feedback.
https://xunit.net/docs/shared-context shows how you write a fixture (the init logic lives in the fixture, not where you have the logic in the ctor)