public static void Setup(TestContext context) { #pragma warning disable CA1062 _classTestContext = context; _verifyPassed = (_classTestContext.Properties["verifyPassed"] as bool?) ?? true; _cleanLogFolder = (_classTestContext.Properties["cleanLogFolder"] as bool?) ?? false; FactoryOrchestratorClient testClientConnection; #pragma warning restore CA1062 try { _serviceIp = _classTestContext.Properties["serviceIp"]?.ToString() ?? "127.0.0.1"; Logger.LogMessage($"Attempting to connect to {_serviceIp}"); testClientConnection = new FactoryOrchestratorClient(IPAddress.Parse(_serviceIp)); // Try to connect to given IP, will throw exception if it fails testClientConnection.Connect().Wait(); } catch (Exception e) { // TODO: Create FOServiceExe instance if one isn't detected and localhost (127.0.0.1) was used. Logger.LogMessage(e.ToString()); Assert.Inconclusive("This test requires a running FactoryOrchestratorService!"); return; } testClientConnection.ResetService(false, false).Wait(); _testContentSrc = _classTestContext.Properties["testContentSrc"]?.ToString() ?? @"C:\TestContentSrc"; _testContentDest = _classTestContext.Properties["testContentDest"]?.ToString() ?? @"C:\TestContent"; _logDest = _classTestContext.Properties["logDest"]?.ToString() ?? Path.Combine(Environment.GetEnvironmentVariable("TEMP"), "clientsampleintegrationtests"); }
public static void Cleanup() { if (_testExecuted) { // Reset service var clientConnection = new FactoryOrchestratorClient(IPAddress.Parse(_serviceIp)); clientConnection.Connect().Wait(); clientConnection.ResetService(false, false).Wait(); } }