Language: C#
Rule: S1118
SonarQube Cloud
- Why do you believe it’s a false-positive/false-negative?
I have an Azure WebApp that I test using WebApplicationFactory<Program>
. Program cannot be made static (since it’s used as type argument), and there’s no reason why I should make it private (or internal + visible to my test assembly)
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
public sealed class Program
{
public static void Main(string[] args)
{
DefaultAzureCredential runtimeAzureCredentials = new();
WebApplicationBuilder builder = CreateWebApplicationBuilder(args);
WebApplication app = builder.Build();
app.Run();
}
...
}
in my tests:
public abstract class IntegrationTestBase: IAsyncDisposable
{
protected WebApplicationFactory<Program> Factory { get; }
...
}