protected IntegrationTestBase() { var path = PlatformServices.Default.Application.ApplicationBasePath; var serverDirectory = Path.GetFullPath(Path.Combine(path, @"../../../../../Application/Programmer.WebServer")); if (!Directory.Exists(serverDirectory)) { throw new DirectoryNotFoundException("Failed to find server root dir in path: " + serverDirectory); } var configurationRoot = new ConfigurationBuilder() .SetBasePath(serverDirectory) .AddJsonFile("appsettings.Test.json") .Build(); var builder = new WebHostBuilder() .UseContentRoot(serverDirectory) .UseStartup <Startup>() // .UseUrls(BaseUri.AbsoluteUri) .UseConfiguration(configurationRoot); Configuration = configurationRoot.Providers.FirstOrDefault(); var server = new TestServer(builder); HttpClient = server.CreateClient(); HttpClient.BaseAddress = server.BaseAddress;; var wsc = server.CreateWebSocketClient(); WebSocket = wsc.ConnectAsync(new Uri(server.BaseAddress, "ws"), CancellationToken.None).Result; _buffer = WebSocket.CreateClientBuffer(1024, 1024); Task.Run(() => WebSocket.ReceiveAsync(_buffer, CancellationToken.None)); EventQueueManager = new EventQueueManager(); EventQueueManager.Flush(); EventQueueManager.Setup(Configuration); }