From f23bf78b343b7e7a940752623bf22ac69ccf971d Mon Sep 17 00:00:00 2001 From: Federico Barresi Date: Fri, 27 Dec 2019 10:09:28 +0100 Subject: [PATCH] Created new test for client connection failed --- Sharp7.Tests/ClientWithoutServer.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Sharp7.Tests/ClientWithoutServer.cs diff --git a/Sharp7.Tests/ClientWithoutServer.cs b/Sharp7.Tests/ClientWithoutServer.cs new file mode 100644 index 0000000..4741107 --- /dev/null +++ b/Sharp7.Tests/ClientWithoutServer.cs @@ -0,0 +1,29 @@ +using System; +using System.Linq; +using Shouldly; +using Xunit; + +namespace Sharp7.Tests +{ + public class ClientWithoutServer + { + private S7Client client; + + public ClientWithoutServer() + { + client = new S7Client(); + } + + public new void Dispose() + { + client.Disconnect(); + } + + [Fact] + public void CannotConnectTest() + { + var rc = client.ConnectTo("127.0.1.2", 0, 2); + rc.ShouldBe(Sharp7.S7Consts.errTCPConnectionFailed); + } + } +} \ No newline at end of file