mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 22:38:27 +08:00
Write large byte array in S7NetTests to check for MaxPDU problems on Snap7.
For me the tests work fine even when adjust the "chunk size" in WriteBytesAsync. So Snap7 seems to be fine, at least the current version. This should probably be tested with some live PLC's as well.
This commit is contained in:
@@ -128,6 +128,26 @@ namespace S7.Net.UnitTest
|
||||
Assert.AreEqual(val3, result3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write/Read a large amount of data to test PDU max
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public async Task Test_Async_WriteLargeByteArray()
|
||||
{
|
||||
Assert.IsTrue(plc.IsConnected, "Before executing this test, the plc must be connected. Check constructor.");
|
||||
|
||||
var randomEngine = new Random();
|
||||
var data = new byte[8192];
|
||||
var db = 2;
|
||||
randomEngine.NextBytes(data);
|
||||
|
||||
await plc.WriteBytesAsync(DataType.DataBlock, db, 0, data);
|
||||
|
||||
var readData = await plc.ReadBytesAsync(DataType.DataBlock, db, 0, data.Length);
|
||||
|
||||
CollectionAssert.AreEqual(data, readData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read/Write a class that has the same properties of a DB with the same field in the same order
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user