Added some TCP wrapper classes for testability

This commit is contained in:
2025-01-28 13:58:01 +01:00
parent 05759f8e12
commit 4ef7500c3b
7 changed files with 185 additions and 7 deletions

View File

@@ -498,7 +498,7 @@ namespace AMWD.Protocols.Modbus.Tests.Tcp
private ModbusTcpConnection GetTcpConnection()
{
_networkStreamMock = new Mock<NetworkStreamWrapper>();
_networkStreamMock = new Mock<NetworkStreamWrapper>(null);
_networkStreamMock
.Setup(ns => ns.WriteAsync(It.IsAny<ReadOnlyMemory<byte>>(), It.IsAny<CancellationToken>()))
.Callback<ReadOnlyMemory<byte>, CancellationToken>((req, _) => _networkRequestCallbacks.Add(req.ToArray()))