There was a nice solution for .NET Core 2.2 posted here https://stackoverflow.com/a/50247041
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.ConfigureTestServices(services =>
{
services
.AddMvc(opts => opts.Filters.Add(new AllowAnonymousFilter()));
});
}
Apparently it stopped working in .NET Core 3.0
Error Message: Expected response.StatusCode to be OK, but found Unauthorized. Stack Trace: at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message) at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message) at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message) at FluentAssertions.Execution.AssertionScope.FailWith(Func'1 failReasonFunc) at FluentAssertions.Execution.AssertionScope.FailWith(Func'1 failReasonFunc) at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) at FluentAssertions.Primitives.ObjectAssertions.Be(Object expected, String because, Object[] becauseArgs)
Does anyone know if there is a similar workaround for the new .NET Core?