Add unit test for the problem.

This commit is contained in:
Serge Camille
2021-06-06 21:59:39 +02:00
parent 0b4c79cb08
commit 0bef6bc9ff

View File

@@ -949,6 +949,33 @@ namespace S7.Net.UnitTest
// Depending on how tests run, this can also just succeed without getting cancelled at all. Do nothing in this case.
Console.WriteLine("Task was not cancelled as expected.");
}
/// <summary>
/// Write a large amount of data and test cancellation
/// </summary>
[TestMethod]
public async Task Test_Async_ParseDataIntoDataItemsAlignment()
{
Assert.IsTrue(plc.IsConnected, "Before executing this test, the plc must be connected. Check constructor.");
var dataItems = new List<DataItem>
{
new DataItem
{
DataType = DataType.DataBlock,
DB = 2,
VarType = VarType.S7String,
Count = 5
},
new DataItem
{
DataType = DataType.DataBlock,
DB = 2,
VarType = VarType.Word,
}
};
await plc.ReadMultipleVarsAsync(dataItems, CancellationToken.None);
}
#endregion
}
}