Skip to content

Commit 52334b7

Browse files
committed
test: 增加单元测试
1 parent 4e78aba commit 52334b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/UnitTest/Services/TcpSocketFactoryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Microsoft.Extensions.Logging;
77
using System.Net;
88
using System.Net.Sockets;
9+
using System.Text;
910

1011
namespace UnitTest.Services;
1112

@@ -94,8 +95,7 @@ public async Task SendAsync_Cancel()
9495
var cst = new CancellationTokenSource();
9596
cst.Cancel();
9697

97-
var data = new ReadOnlyMemory<byte>([1, 2, 3, 4, 5]);
98-
var result = await client.SendAsync(data, cst.Token);
98+
var result = await client.SendAsync("test", null, cst.Token);
9999
Assert.False(result);
100100

101101
// 设置延时发送适配器
@@ -110,7 +110,7 @@ public async Task SendAsync_Cancel()
110110
// 测试发送失败逻辑
111111
_ = Task.Run(async () =>
112112
{
113-
sendResult = await client.SendAsync(data);
113+
sendResult = await client.SendAsync("test", Encoding.UTF8);
114114
tcs.SetResult();
115115
});
116116

0 commit comments

Comments
 (0)