Skip to content

Commit dc8b582

Browse files
committed
fix test
1 parent 10e5d2f commit dc8b582

22 files changed

+44
-81
lines changed

src/SocketIOClient.Sample/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ static async Task Main(string[] args)
2121
Query = new Dictionary<string, string>
2222
{
2323
{"token", "V2" }
24-
}
24+
},
25+
AutoUpgrade = false
2526
});
2627

2728
socket.OnConnected += Socket_OnConnected;
@@ -36,7 +37,7 @@ static async Task Main(string[] args)
3637
});
3738
socket.On("hi", response =>
3839
{
39-
// Console.WriteLine(response.ToString());
40+
// Console.WriteLine(response.ToString());
4041
Console.WriteLine(response.GetValue<string>());
4142
});
4243

@@ -67,7 +68,8 @@ private static async void Socket_OnConnected(object sender, EventArgs e)
6768
//while (true)
6869
//{
6970
// await Task.Delay(1000);
70-
await socket.EmitAsync("hi", DateTime.Now.ToShortDateString());
71+
//await socket.EmitAsync("hi", DateTime.Now.ToShortDateString());
72+
await socket.EmitAsync("welcome");
7173
//}
7274
//byte[] bytes = Encoding.UTF8.GetBytes("ClientCallsServerCallback_1Params_0");
7375
//await socket.EmitAsync("client calls the server's callback 1", bytes);

src/SocketIOClient.Test/SocketIOClient.Test.csproj

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,6 @@
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<Compile Remove="SocketIOTests\V2\DisconnectionV2NspTest.cs" />
10-
<Compile Remove="SocketIOTests\V2\DisconnectionV2Test.cs" />
11-
<Compile Remove="SocketIOTests\V2\EmitV2NspTest.cs" />
12-
<Compile Remove="SocketIOTests\V2\EmitV2Test.cs" />
13-
<Compile Remove="SocketIOTests\V2\OffAnyV2NspTest.cs" />
14-
<Compile Remove="SocketIOTests\V2\OffAnyV2Test.cs" />
15-
<Compile Remove="SocketIOTests\V2\OffV2NspTest.cs" />
16-
<Compile Remove="SocketIOTests\V2\OffV2Test.cs" />
17-
<Compile Remove="SocketIOTests\V2\OnAnyV2NspTest.cs" />
18-
<Compile Remove="SocketIOTests\V2\OnAnyV2Test.cs" />
19-
<Compile Remove="SocketIOTests\V2\OnErrorV2NspTest.cs" />
20-
<Compile Remove="SocketIOTests\V2\OnErrorV2Test.cs" />
21-
<Compile Remove="SocketIOTests\V2\ReconnectionV2NspTest.cs" />
22-
<Compile Remove="SocketIOTests\V2\ReconnectionV2Test.cs" />
23-
<Compile Remove="SocketIOTests\V2\ServerV2Manager.cs" />
24-
<Compile Remove="SocketIOTests\V2\SocketIOV2Creator.cs" />
25-
<Compile Remove="SocketIOTests\V2\SocketIOV2NspCreator.cs" />
26-
</ItemGroup>
27-
28-
<ItemGroup>
29-
<None Include="SocketIOTests\V2\DisconnectionV2NspTest.cs" />
30-
<None Include="SocketIOTests\V2\DisconnectionV2Test.cs" />
31-
<None Include="SocketIOTests\V2\EmitV2NspTest.cs" />
32-
<None Include="SocketIOTests\V2\EmitV2Test.cs" />
33-
<None Include="SocketIOTests\V2\OffAnyV2NspTest.cs" />
34-
<None Include="SocketIOTests\V2\OffAnyV2Test.cs" />
35-
<None Include="SocketIOTests\V2\OffV2NspTest.cs" />
36-
<None Include="SocketIOTests\V2\OffV2Test.cs" />
37-
<None Include="SocketIOTests\V2\OnAnyV2NspTest.cs" />
38-
<None Include="SocketIOTests\V2\OnAnyV2Test.cs" />
39-
<None Include="SocketIOTests\V2\OnErrorV2NspTest.cs" />
40-
<None Include="SocketIOTests\V2\OnErrorV2Test.cs" />
41-
<None Include="SocketIOTests\V2\ReconnectionV2NspTest.cs" />
42-
<None Include="SocketIOTests\V2\ReconnectionV2Test.cs" />
43-
<None Include="SocketIOTests\V2\ServerV2Manager.cs" />
44-
<None Include="SocketIOTests\V2\SocketIOV2Creator.cs" />
45-
<None Include="SocketIOTests\V2\SocketIOV2NspCreator.cs" />
46-
</ItemGroup>
47-
488
<ItemGroup>
499
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
5010
<PackageReference Include="Moq" Version="4.16.1" />

src/SocketIOClient.Test/SocketIOTests/AssemblyIntegrationTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Microsoft.VisualStudio.TestTools.UnitTesting;
22
using SocketIOClient.Test.Configuration;
3+
using SocketIOClient.Test.SocketIOTests.V2;
4+
using SocketIOClient.Test.SocketIOTests.V3;
35
using SocketIOClient.Test.SocketIOTests.V4;
46
using System;
57
using System.Collections.Generic;
@@ -13,7 +15,7 @@ public class AssemblyIntegrationTest
1315
{
1416
private static readonly IEnumerable<IServerManager> Servers = new List<IServerManager>()
1517
{
16-
//new ServerV2Manager(),
18+
new ServerV2Manager(),
1719
new ServerV3Manager(),
1820
new ServerV4Manager()
1921
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using System.Threading.Tasks;
3+
4+
namespace SocketIOClient.Test.SocketIOTests.V2
5+
{
6+
[TestClass]
7+
public class HeadersV2Test : HeadersTest
8+
{
9+
public HeadersV2Test()
10+
{
11+
SocketIOCreator = new SocketIOV2Creator();
12+
}
13+
14+
protected override ISocketIOCreateable SocketIOCreator { get; }
15+
16+
[TestMethod]
17+
public override async Task CustomHeader()
18+
{
19+
await base.CustomHeader();
20+
}
21+
}
22+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace SocketIOClient.Test.SocketIOTests.V2
55
{
66
[TestClass]
7-
public class OffAnyV2NspTest : OnAnyTest
7+
public class OffAnyV2NspTest : OffTest
88
{
99
public OffAnyV2NspTest()
1010
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public OnErrorV2NspTest()
1313

1414
protected override ISocketIOCreateable SocketIOCreator { get; }
1515

16+
1617
[TestMethod]
1718
public override async Task Test()
1819
{

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ public ReconnectionV2Test()
2020
// await base.ReconnectionTrueTest();
2121
//}
2222

23+
// NOTE: This test case is wrong, because the client will not automatically reconnect after the server closes the connection.
24+
//[TestMethod]
25+
//public override async Task ReconnectionAttemptsExceededTest()
26+
//{
27+
// await base.ReconnectionAttemptsExceededTest();
28+
//}
29+
2330
[TestMethod]
2431
public override async Task ReconnectionFalseTest()
2532
{
@@ -33,13 +40,6 @@ public override async Task ReconnectionFalseTest()
3340
// await base.ReconnectingTest();
3441
//}
3542

36-
// NOTE: This test case is wrong, because the client will not automatically reconnect after the server closes the connection.
37-
//[TestMethod]
38-
//public override async Task ReconnectionAttemptsExceededTest()
39-
//{
40-
// await base.ReconnectionAttemptsExceededTest();
41-
//}
42-
4343
[TestMethod]
4444
public override async Task ManuallyReconnectionTest()
4545
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SocketIOClient.Test.SocketIOTests.V4
1+
namespace SocketIOClient.Test.SocketIOTests.V2
22
{
33
public class ServerV2Manager : BaseServerManager, IServerManager
44
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public SocketIO Create(bool reconnection = false)
1717
}
1818

1919
public string Prefix => "V2: ";
20-
public string Url => "http://localhost:11002";
2120
public string Token => "V2";
21+
public string Url => "http://localhost:11002";
2222
}
2323
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ public SocketIO Create(bool reconnection = false)
1919
public string Prefix => "/nsp,V2: ";
2020
public string Url => "http://localhost:11002/nsp";
2121
public string Token => "V2";
22-
public int EIO => 3;
2322
}
2423
}

0 commit comments

Comments
 (0)