fix bug: couldn't convert package

This commit is contained in:
2025-04-17 14:25:37 +08:00
parent 3b674f413a
commit d25f9882fc
7 changed files with 187 additions and 45 deletions

View File

@@ -111,12 +111,12 @@ public class UDPServerTest
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, NumberProcessor.NumberToBytes(number, 4).Value));
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 4).Value));
var ret = await udpServer.FindDataAsync(address);
Assert.True(ret.HasValue);
var data = ret.Value;
Assert.Equal(address, data.Address);
Assert.Equal(number, NumberProcessor.BytesToNumber(data.Data));
Assert.Equal(number, Number.BytesToNumber(data.Data));
}
}
@@ -130,13 +130,13 @@ public class UDPServerTest
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, NumberProcessor.NumberToBytes(number, 4).Value));
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 4).Value));
var ret = await udpServer.WaitForAckAsync(address);
Assert.True(ret.IsSuccessful);
var data = ret.Value;
Assert.True(data.IsSuccessful);
Assert.Equal(number, NumberProcessor.BytesToNumber(data.ToBytes()));
Assert.Equal(number, Number.BytesToNumber(data.ToBytes()));
}
}
@@ -150,13 +150,13 @@ public class UDPServerTest
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, NumberProcessor.NumberToBytes(number, 8).Value));
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 8).Value));
var ret = await udpServer.WaitForDataAsync(address);
Assert.True(ret.IsSuccessful);
var data = ret.Value;
Assert.True(data.IsSuccessful);
Assert.Equal(number, NumberProcessor.BytesToNumber(data.ToBytes()));
Assert.Equal(number, Number.BytesToNumber(data.ToBytes()));
}
}
}