Skip to content

Commit 85d8c40

Browse files
committed
test: array as one parameter
1 parent 9bff57c commit 85d8c40

File tree

7 files changed

+58
-1
lines changed

7 files changed

+58
-1
lines changed

src/SocketIOClient.Test/SocketIOTests/EmitTest.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SocketIOClient.Test.SocketIOTests
88
{
99
public abstract class EmitTest
1010
{
11-
protected abstract ISocketIOCreateable SocketIOCreator { get; }
11+
protected abstract ISocketIOCreateable SocketIOCreator { get; }
1212

1313
public virtual async Task Hi()
1414
{
@@ -370,6 +370,27 @@ public virtual async Task EmitWith1ParamsBytesInObject()
370370
Assert.AreEqual(6, model.Code);
371371
Assert.AreEqual(longString, Encoding.UTF8.GetString(model.Message));
372372
}
373+
374+
public virtual async Task EmitWith1ParamsArray()
375+
{
376+
SocketIOResponse result = null;
377+
var client = SocketIOCreator.Create();
378+
client.On("1 params", response =>
379+
{
380+
result = response;
381+
});
382+
client.OnConnected += async (sender, e) =>
383+
{
384+
await client.EmitAsync("1 params", (object)new object[] { 1, true, "test" });
385+
};
386+
await client.ConnectAsync();
387+
await Task.Delay(200);
388+
await client.DisconnectAsync();
389+
390+
Assert.AreEqual(1, result.GetValue()[0].GetInt32());
391+
Assert.AreEqual(true, result.GetValue()[1].GetBoolean());
392+
Assert.AreEqual("test", result.GetValue()[2].GetString());
393+
}
373394
#endregion
374395

375396
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V2/EmitV2NspTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V2/EmitV2Test.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V3/EmitV3NspTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V3/EmitV3Test.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V4/EmitV4NspTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

src/SocketIOClient.Test/SocketIOTests/V4/EmitV4Test.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public override async Task EmitWith2ParamsBytes()
109109
{
110110
await base.EmitWith2ParamsBytes();
111111
}
112+
113+
[TestMethod]
114+
public override async Task EmitWith1ParamsArray()
115+
{
116+
await base.EmitWith1ParamsArray();
117+
}
112118
#endregion
113119

114120
#region Emit with 2 params

0 commit comments

Comments
 (0)