public WebTests(ITestOutputHelper output) { this.output = output; LoggerConfiguration logConfig = new LoggerConfiguration().WriteTo.Console() .WriteTo.TestOutput(output, LogEventLevel.Verbose); Log.Logger = logConfig.CreateLogger(); // Set up web module if (!File.Exists(this.configFile)) { File.WriteAllText(this.configFile, JsonConvert.SerializeObject(new WebConfig { EngineConfig = new EngineConfig { DatastoreConfig = new MongoDbConfig { MongoHostnames = new[] { "127.0.0.1:27017" }, MongoAuthDb = "admin", MongoCollection = "MagnumMicroservices", MongoPassword = "******", MongoUser = "******", UseReplicaSet = false, SslConfig = new MongoDbSslConfig { UseSsl = false } }, QueueConfig = new RabbitQueueConfig { Hostname = "127.0.0.1", Username = "******", Password = "******" } }, UseSsl = true, Port = 6883, SslCertLocation = "Cert.pfx", SslCertPassword = "******", UseAuth = true, UseCloudWatchLogging = false }, Formatting.Indented)); throw new Exception("Failed to find config file. Created default."); } string configText = File.ReadAllText(this.configFile); this.webConfig = WebConfigHelper.FromJson(configText); this.webModule = new Task(() => { Program.Main(new[] { "--config", this.configFile, "--tokens", this.tokensFile }); }); this.webModule.Start(); Thread.Sleep(10000); // Read in tokens string tokensText = File.ReadAllText(this.tokensFile); string[] split = tokensText.Split('\"'); tokens = split[1] + ":" + split[3]; // Set up queue id this.testQueueId = "TESTAPPLICATION" + DateTime.UtcNow.ToString("u").Replace(" ", "").Replace("-", "").Replace(":", ""); // Store default SSL certificate validation method so we can revert back after we change it HttpClientHandler handler = new HttpClientHandler { SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true }; client = new HttpClient(handler); submitUri = $"https://localhost:{this.webConfig.Port}/job/submit/"; requestUri = $"https://localhost:{this.webConfig.Port}/job/request/"; completeUri = $"https://localhost:{this.webConfig.Port}/job/complete/"; emptyUri = $"https://localhost:{this.webConfig.Port}/job/isempty/"; failUri = $"https://localhost:{this.webConfig.Port}/job/fail/"; }