Reconfigure dependencies when Integration testing ASP.NET Core Web API and EF Core

@ilya-chumakov’s answer is awesome. I just would like to add one more option 3. Use ConfigureTestServices method from WebHostBuilderExtensions. The method ConfigureTestServices is available in the Microsoft.AspNetCore.TestHost version 2.1(on 20.05.2018 it is RC1-final). And it lets us override existing registrations with mocks. The code: _server = new TestServer(new WebHostBuilder() .UseStartup<Startup>() .ConfigureTestServices(services => { services.AddTransient<IFooService, MockService>(); … Read more

How to implement XUnit descriptive Assert message?

Use the suggestions provided at the link. Like fluent assertions or create your own assertion that wraps the Assert.True or Assert.False which were left with their message overloads. It was mentioned further down Quote You can provide messages to Assert.True and .False. If you simply cannot live without messages (and refuse to use a different … Read more

Why is the Visual Studio 2015/2017/2019 Test Runner not discovering my xUnit v2 tests

Eliminate discovery exceptions from your inquiries; go to the output Window (Ctrl-Alt-O), then switch the show output from dropdown (Shift-Alt-S) to Tests and make sure there are no discovery exceptions Test|Test settings|Default processor architecture can help if your tests are x86/x64 specific and discovery is triggering bittedness-related exceptions, i.e. not AnyCpu As suggested in this … Read more