public async Task <List <TlsTestResult> > Test(string host) { List <TlsTestResult> testResults = new List <TlsTestResult>(); var sw = new Stopwatch(); _log.LogDebug($"Beginning test run of {_tests.Count} tests for {host ?? "null"}"); foreach (ITlsTest test in _tests) { sw.Restart(); _log.LogDebug($"Running test {test.Id} - {test.Name} for {host ?? "null"}"); ITlsClient tlsClient = _tlsClientFactory.Create(); try { BouncyCastleTlsTestResult result = await tlsClient.Connect(host, Port, test.Version, test.CipherSuites); _log.LogDebug($"Result of test {test.Id} - {test.Name} for {host ?? "null"}:{ Environment.NewLine}{JsonConvert.SerializeObject(result, JsonSerializerSettings)}"); testResults.Add(new TlsTestResult(test, result)); } finally { _log.LogDebug($"TLS test {test.Id} - {test.Name} for host {host ?? "null"} completed in {sw.ElapsedMilliseconds}ms"); tlsClient.Disconnect(); } } return(testResults); }
public async Task <List <TlsTestResult> > Test(string host) { List <TlsTestResult> testResults = new List <TlsTestResult>(); foreach (ITlsTest test in _tests) { _log.Debug($"Running test {test.Id} - {test.Name} for {host ?? "null"}"); TlsConnectionResult result = await _client.Connect(host, Port, test.Version, test.CipherSuites); _client.Disconnect(); _log.Debug($"Result:{Environment.NewLine}{result}"); testResults.Add(new TlsTestResult(test, result)); } return(testResults); }