diff --git a/appveyor.yml b/appveyor.yml
index 56f84c117..195a144cc 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,13 +19,14 @@ for:
build_script:
- echo build
- - dotnet build Renci.SshNet.sln -c Debug -f net8.0
+ - dotnet build -f net8.0 -c Debug test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
+ - dotnet build -f net8.0 -c Debug test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
test_script:
- sh: echo "Run unit tests"
- sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
- sh: echo "Run integration tests"
- - sh: dotnet test -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
+ - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
# on_failure:
# - sh: appveyor PushArtifact artifacts/tcpdump.pcap
diff --git a/test/Renci.SshNet.IntegrationTests/App.config b/test/Renci.SshNet.IntegrationTests/App.config
deleted file mode 100644
index c9794e84d..000000000
--- a/test/Renci.SshNet.IntegrationTests/App.config
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/Renci.SshNet.IntegrationTests/Common/DateTimeExtensions.cs b/test/Renci.SshNet.IntegrationTests/Common/DateTimeExtensions.cs
index d9f0d22e7..7617d1d63 100644
--- a/test/Renci.SshNet.IntegrationTests/Common/DateTimeExtensions.cs
+++ b/test/Renci.SshNet.IntegrationTests/Common/DateTimeExtensions.cs
@@ -4,9 +4,7 @@ public static class DateTimeExtensions
{
public static DateTime TruncateToWholeSeconds(this DateTime dateTime)
{
- return dateTime.AddMilliseconds(-dateTime.Millisecond)
- .AddMicroseconds(-dateTime.Microsecond)
- .AddTicks(-(dateTime.Nanosecond / 100));
+ return new DateTime(dateTime.Ticks - (dateTime.Ticks % TimeSpan.TicksPerSecond), dateTime.Kind);
}
}
}
diff --git a/test/Renci.SshNet.IntegrationTests/HostConfig.cs b/test/Renci.SshNet.IntegrationTests/HostConfig.cs
index c328a729c..fd3c3f133 100644
--- a/test/Renci.SshNet.IntegrationTests/HostConfig.cs
+++ b/test/Renci.SshNet.IntegrationTests/HostConfig.cs
@@ -29,7 +29,11 @@ public static HostConfig Read(ScpClient scpClient, string path)
while ((line = sr.ReadLine()) != null)
{
// skip comments
+#if NET
if (line.StartsWith('#'))
+#else
+ if (line.StartsWith("#"))
+#endif
{
continue;
}
diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs
index ec28a738e..09ce7cd7f 100644
--- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs
+++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs
@@ -1,4 +1,7 @@
using System.Diagnostics;
+#if !NET6_0_OR_GREATER
+using System.Net;
+#endif
using Renci.SshNet.Common;
@@ -46,8 +49,8 @@ public void Test_PortForwarding_Local_Stop_Hangs_On_Wait()
.GetAwaiter()
.GetResult();
#else
- var request = (HttpWebRequest) WebRequest.Create(url);
- var response = (HttpWebResponse) request.GetResponse();
+ var request = (HttpWebRequest) WebRequest.Create(url);
+ var response = (HttpWebResponse) request.GetResponse();
#endif // NET6_0_OR_GREATER
Assert.IsNotNull(response);
@@ -122,10 +125,10 @@ public void Test_PortForwarding_Local_Without_Connecting()
{
var data = ReadStream(response.Content.ReadAsStream());
#else
- var request = (HttpWebRequest) WebRequest.Create("http://localhost:8084");
- using (var response = (HttpWebResponse) request.GetResponse())
- {
- var data = ReadStream(response.GetResponseStream());
+ var request = (HttpWebRequest) WebRequest.Create("http://localhost:8084");
+ using (var response = (HttpWebResponse) request.GetResponse())
+ {
+ var data = ReadStream(response.GetResponseStream());
#endif // NET6_0_OR_GREATER
var end = DateTime.Now;
diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.cs
index 1c7def55b..3c49e60fa 100644
--- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.cs
+++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.cs
@@ -14,7 +14,11 @@ protected static string CalculateMD5(string fileName)
{
using (FileStream file = new FileStream(fileName, FileMode.Open))
{
- var hash = MD5.HashData(file);
+ byte[] hash;
+ using (var md5 = MD5.Create())
+ {
+ hash = md5.ComputeHash(file);
+ }
file.Close();
diff --git a/test/Renci.SshNet.IntegrationTests/Program.cs b/test/Renci.SshNet.IntegrationTests/Program.cs
deleted file mode 100644
index af2b60d51..000000000
--- a/test/Renci.SshNet.IntegrationTests/Program.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Renci.SshNet.IntegrationTests
-{
- class Program
- {
-#if NETFRAMEWORK
- private static void Main()
- {
- }
-#endif
- }
-}
diff --git a/test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj b/test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
index f55b67440..109da05d2 100644
--- a/test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
+++ b/test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
@@ -1,11 +1,12 @@
- net8.0
+ net48;net8.0
enable
false
true
$(NoWarn);SYSLIB0021;SYSLIB1045;SYSLIB0014;IDE0220;IDE0010
+ true
diff --git a/test/Renci.SshNet.TestTools.OpenSSH/Renci.SshNet.TestTools.OpenSSH.csproj b/test/Renci.SshNet.TestTools.OpenSSH/Renci.SshNet.TestTools.OpenSSH.csproj
index b60661536..a6dbd202d 100644
--- a/test/Renci.SshNet.TestTools.OpenSSH/Renci.SshNet.TestTools.OpenSSH.csproj
+++ b/test/Renci.SshNet.TestTools.OpenSSH/Renci.SshNet.TestTools.OpenSSH.csproj
@@ -1,6 +1,6 @@
- net8.0
+ netstandard2.0
enable
enable
$(NoWarn);SYSLIB0021;SYSLIB1045
diff --git a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs
index 5e3025711..048e1ca77 100644
--- a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs
+++ b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs
@@ -329,7 +329,7 @@ private static void ProcessGlobalOption(SshdConfig sshdConfig, string line)
sshdConfig.KeyboardInteractiveAuthentication = ToBool(value);
break;
case "LogLevel":
- sshdConfig.LogLevel = Enum.Parse(value, ignoreCase: true);
+ sshdConfig.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), value, ignoreCase: true);
break;
case "Subsystem":
sshdConfig.Subsystems.Add(Subsystem.FromConfig(value));