From 36b59a2926b6f4fcfbd2bb125f1492f063ec98f0 Mon Sep 17 00:00:00 2001 From: Michael Croes Date: Sun, 6 Jun 2021 23:20:19 +0200 Subject: [PATCH] Cleanup whitespace, usings --- S7.Net.UnitTest/ProtocolTests.cs | 11 +++-------- S7.Net/COTP.cs | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/S7.Net.UnitTest/ProtocolTests.cs b/S7.Net.UnitTest/ProtocolTests.cs index 4cd634d..e63fac6 100644 --- a/S7.Net.UnitTest/ProtocolTests.cs +++ b/S7.Net.UnitTest/ProtocolTests.cs @@ -1,14 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using S7.Net; - using System.IO; +using System.Linq; +using System.Threading; using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; using S7.Net.Protocol; -using System.Collections; namespace S7.Net.UnitTest { @@ -69,7 +65,6 @@ namespace S7.Net.UnitTest var t = await COTP.TSDU.ReadAsync(m, CancellationToken.None); Assert.IsTrue(expected.SequenceEqual(t)); - // Test all possible byte values. Everything except 0xff should throw an exception. var testData = Enumerable.Range(0, 256).Select(i => new { StatusCode = (ReadWriteErrorCode)i, ThrowsException = i != (byte)ReadWriteErrorCode.Success }); diff --git a/S7.Net/COTP.cs b/S7.Net/COTP.cs index 0300295..3e5abbb 100644 --- a/S7.Net/COTP.cs +++ b/S7.Net/COTP.cs @@ -91,7 +91,7 @@ namespace S7.Net /// The stream to read from /// Data in TSDU public static async Task ReadAsync(Stream stream, CancellationToken cancellationToken) - { + { var segment = await TPDU.ReadAsync(stream, cancellationToken).ConfigureAwait(false); if (segment.LastDataUnit)