diff --git a/Core.Tests/Remote/PiscalSshClientTests.cs b/Core.Tests/Remote/PiscalSshClientTests.cs index 07ddb64..68a2780 100644 --- a/Core.Tests/Remote/PiscalSshClientTests.cs +++ b/Core.Tests/Remote/PiscalSshClientTests.cs @@ -13,7 +13,7 @@ namespace LeafWeb.Core.Tests.Remote { private const string ContentDirectory = @"Parsers\LeafInputData\"; - private readonly PiscalLeafInput _testInput = + private readonly PiscalLeafInput _validInput = new PiscalLeafInput { LeafInputId = 1, @@ -53,14 +53,14 @@ namespace LeafWeb.Core.Tests.Remote public void SubmitLeafInputFile() { var client = GetTestClient(); - client.RunLeafInput(_testInput); + client.RunLeafInput(_validInput); } [Test, Explicit] public void GetLeafInputStatus() { var client = GetTestClient(); - var leafInputStatus = client.GetLeafInputStatus(_testInput); + var leafInputStatus = client.GetLeafInputStatus(_validInput); Console.WriteLine(leafInputStatus); } @@ -68,7 +68,7 @@ namespace LeafWeb.Core.Tests.Remote public void RetrieveLeafOutput() { var client = GetTestClient(); - var result = client.RetrieveLeafOutput(_testInput).ToList(); + var result = client.RetrieveLeafOutput(_validInput).ToList(); Console.WriteLine(string.Join(", ", result.Select(o => o.Filename))); //Console.WriteLine(result[0].Contents.GetString()); } @@ -77,14 +77,14 @@ namespace LeafWeb.Core.Tests.Remote public void CleanLeafOutput() { var client = GetTestClient(); - client.CleanupLeafProcess(_testInput); + client.CleanupLeafProcess(_validInput); } [Test, Explicit] public void KillLeafProcess() { var client = GetTestClient(); - client.KillLeafProcess(_testInput); + client.KillLeafProcess(_validInput); } } } diff --git a/Core/Remote/PiscalSshClient.cs b/Core/Remote/PiscalSshClient.cs index e395184..e6b6bbe 100644 --- a/Core/Remote/PiscalSshClient.cs +++ b/Core/Remote/PiscalSshClient.cs @@ -29,7 +29,7 @@ namespace LeafWeb.Core.Remote private const string StatusRunning = "running"; private const string StatusNotStarted = "not started"; - private readonly ILog _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILog _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()?.DeclaringType); private readonly int _connectionRetryCount = 3; private readonly Policy _connectRetryPolicy; @@ -37,11 +37,11 @@ namespace LeafWeb.Core.Remote public PiscalSshClient(string connectionString) { if (string.IsNullOrEmpty(connectionString)) - throw new ArgumentNullException("connectionString"); + throw new ArgumentNullException(nameof(connectionString)); var conn = new DbConnectionStringBuilder {ConnectionString = connectionString}; _host = conn["host"] as string; - _port = int.Parse(conn.ContainsKey("port") ? conn["port"] as string : "22"); // default 22 + _port = int.Parse(conn["port"] as string ?? "22"); // default 22 var username = conn["username"] as string; var password = conn["password"] as string; _connectionInfo = new PasswordConnectionInfo(_host, _port, username, password);