Answer the question
In order to leave comments, you need to log in
How to give the Program class the public modifier in c# 9.0?
Hello everyone, Top-level instructions
appeared in Nome Sharp
instead of such an entry
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
using System;
Console.WriteLine("Hello World!");
internal class FunctionalTestsApiApplication : WebApplicationFactory<Program>
{
protected override IHost CreateHost(IHostBuilder builder)
{
...
[Fact]
public async Task Login()
{
// Arrange
await using var application = new FunctionalTestsApiApplication();
var client = application.CreateClient();
...
public class Auth: IClassFixture<WebApplicationFactory<Program>>
{
private readonly WebApplicationFactory<Program> _factory;
private readonly IUserArrangeService _userService;
public Auth(WebApplicationFactory<Program> factory, IUserArrangeService userService)
{
_factory = factory;
_userService = userService;
}
Answer the question
In order to leave comments, you need to log in
They suggested that I rewrote the Program class in the old format:
namespace Api
{
public class Program
{
static void Main(string[] args)
{
using...
...
app.Run();
public partial class Program { /* Expose the Program class for use with WebApplicationFactory<T> */ }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question