From 8f3c701a2f91f0c8c36225c6263bea0ec99e85a3 Mon Sep 17 00:00:00 2001 From: Serge Camille Date: Sun, 13 Sep 2020 10:28:06 +0200 Subject: [PATCH] Revert UnitTest IP address to 127.0.0.1. Seems there are sometimes performance regressions when using localhost. Might be related to IPv6, who know. Fix some TestContext not being public. --- S7.Net.UnitTest/ProtocolTests.cs | 2 +- S7.Net.UnitTest/S7NetTestsSync.cs | 3 ++- S7.Net.UnitTest/StreamTests.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/S7.Net.UnitTest/ProtocolTests.cs b/S7.Net.UnitTest/ProtocolTests.cs index 4d53f17..b18ebe8 100644 --- a/S7.Net.UnitTest/ProtocolTests.cs +++ b/S7.Net.UnitTest/ProtocolTests.cs @@ -13,7 +13,7 @@ namespace S7.Net.UnitTest [TestClass] public class ProtocolUnitTest { - private TestContext TestContext { get; set; } + public TestContext TestContext { get; set; } [TestMethod] public async Task TPKT_Read() diff --git a/S7.Net.UnitTest/S7NetTestsSync.cs b/S7.Net.UnitTest/S7NetTestsSync.cs index 0ad4efa..162c5a2 100644 --- a/S7.Net.UnitTest/S7NetTestsSync.cs +++ b/S7.Net.UnitTest/S7NetTestsSync.cs @@ -38,6 +38,7 @@ namespace S7.Net.UnitTest const int DB2 = 2; const int DB4 = 4; const short TestServerPort = 31122; + const string TestServerIp = "127.0.0.1"; #endregion #region Private fields @@ -56,7 +57,7 @@ namespace S7.Net.UnitTest private static Plc CreatePlc() { - return new Plc(CpuType.S7300, "localhost", TestServerPort, 0, 2); + return new Plc(CpuType.S7300, TestServerIp, TestServerPort, 0, 2); } [TestInitialize] diff --git a/S7.Net.UnitTest/StreamTests.cs b/S7.Net.UnitTest/StreamTests.cs index 375c02c..9cb0969 100644 --- a/S7.Net.UnitTest/StreamTests.cs +++ b/S7.Net.UnitTest/StreamTests.cs @@ -65,7 +65,7 @@ namespace S7.Net.UnitTest [TestClass] public class StreamTests { - private TestContext TestContext { get; set; } + public TestContext TestContext { get; set; } [TestMethod] public async Task TPKT_ReadRestrictedStreamAsync()