Codit / practical-api-guidelines

Practical guidelines for building & designing APIs with .NET.
MIT License
16 stars 5 forks source link

Use XUnit fixture for integration test #112

Closed pietersap closed 5 years ago

pietersap commented 5 years ago

Similar to #99 , test server should be initialized once for all tests using an XUnit fixture, instead of creating it in the test constructor

       public ProblemJsonTest()
        {
            if (_httpClient != null) { return; }
            var srv = new TestServer(new WebHostBuilder()
                .UseEnvironment("Development")
                .UseStartup<Startup>());

            _httpClient = srv.CreateClient();
        }