Skip to content

Commit c6deda8

Browse files
committed
refactor EngineIO3Adapter
1 parent 5f5faf7 commit c6deda8

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

src/SocketIOClient/V2/Session/EngineIOHttpAdapter/EngineIO3Adapter.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public IHttpRequest ToHttpRequest(ICollection<byte[]> bytes)
1414
{
1515
throw new ArgumentException("The array cannot be empty");
1616
}
17-
if (bytes.Any(b => b.Length == 0))
18-
{
19-
throw new ArgumentException("The sub array cannot be empty");
20-
}
2117
var req = new HttpRequest
2218
{
2319
Method = RequestMethod.Post,

tests/SocketIOClient.UnitTests/V2/Session/EngineIOHttpAdapter/EngineIO3AdapterTests.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ public void ToHttpRequest_GivenAnEmptyArray_ThrowException()
2424
.WithMessage("The array cannot be empty");
2525
}
2626

27-
[Fact]
28-
public void ToHttpRequest_GivenAnEmptySubBytes_ThrowException()
29-
{
30-
var bytes = new List<byte[]>
31-
{
32-
Array.Empty<byte>(),
33-
};
34-
_adapter
35-
.Invoking(x => x.ToHttpRequest(bytes))
36-
.Should()
37-
.Throw<ArgumentException>()
38-
.WithMessage("The sub array cannot be empty");
39-
}
40-
4127
private static readonly (ICollection<byte[]> bytes, IHttpRequest req) OneItem1Byte = new(new List<byte[]>
4228
{
4329
new byte[] { 1 },
@@ -102,8 +88,6 @@ public void ToHttpRequest_WhenCalled_AlwaysPass(ICollection<byte[]> bytes, IHttp
10288
req.Should().BeEquivalentTo(result);
10389
}
10490

105-
private static readonly (string raw, IEnumerable<string> textMessages) GetMessagesSinglePing = new("1:2", ["2"]);
106-
10791
private static readonly (string raw, IEnumerable<string> textMessages) GetMessagesSingleHelloWorld = new(
10892
"12:hello world!",
10993
["hello world!"]);
@@ -115,10 +99,6 @@ public void ToHttpRequest_WhenCalled_AlwaysPass(ICollection<byte[]> bytes, IHttp
11599
public static TheoryData<string, IEnumerable<string>> GetMessagesCases =>
116100
new()
117101
{
118-
{
119-
GetMessagesSinglePing.raw,
120-
GetMessagesSinglePing.textMessages
121-
},
122102
{
123103
GetMessagesSingleHelloWorld.raw,
124104
GetMessagesSingleHelloWorld.textMessages
@@ -133,6 +113,7 @@ public void ToHttpRequest_WhenCalled_AlwaysPass(ICollection<byte[]> bytes, IHttp
133113
[MemberData(nameof(GetMessagesCases))]
134114
public void GetMessages_WhenCalled_AlwaysPass(string raw, IEnumerable<string> textMessages)
135115
{
116+
// Note: EngineIO3 bytes are handled by HttpSession directly, no need to test bytes here
136117
_adapter.GetMessages(raw)
137118
.Select(m => m.Text)
138119
.Should()

0 commit comments

Comments
 (0)