public End2EndTests(PostgreSqlFixture postgresFixture, RedisFixture redisFixture, ITestOutputHelper testOutputHelper) { _testOutputHelper = testOutputHelper; _host = WebHost.CreateDefaultBuilder() .UseStartup <Startup>() .UseTestServer() .ConfigureTestServices(services => { // add document store pointing to postgres testcontainer services.AddDocumentStore(postgresFixture.ConnectionString); services.AddSignalR() .AddJsonProtocol() // add redis pointing to testcontainer .AddStackExchangeRedis(redisFixture.ConnectionString); }) .Build(); _host.Start(); _httpClient = _host.GetTestClient(); var httpMessageHandler = _host.GetTestServer().CreateHandler(); _signalRConnection = new HubConnectionBuilder() .AddJsonProtocol() .WithUrl($"{_httpClient.BaseAddress}hubs/review", options => { options.HttpMessageHandlerFactory = _ => httpMessageHandler; }) .Build(); }
public static BlogClient GetBlogClient(this IWebHost host, UserContext user = null) { var client = host.GetTestClient(); client.BaseAddress = new Uri("http://localhost/graphql/"); // proper base address needs to be set if (user is {})