-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move signalr and management e2e test to standalone project (#579)
* move signalr and management e2e test to standalone project avoid HttpClientConnection version conflict * remove unnecessary pkg
- Loading branch information
Showing
15 changed files
with
97 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
26 changes: 25 additions & 1 deletion
26
test/Microsoft.Azure.SignalR.E2ETests/Microsoft.Azure.SignalR.E2ETests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\Microsoft.Azure.SignalR.Tests\JwtTokenHelper.cs" Link="JwtTokenHelper.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" /> | ||
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="$(MicrosoftAspNetCoreSignalRClientTest)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Microsoft.Azure.SignalR.Tests.Common\Microsoft.Azure.SignalR.Tests.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(AzureSignalRSDKE2ETest)' != 'true' "> | ||
<ProjectReference Include="..\..\src\Microsoft.Azure.SignalR.Management\Microsoft.Azure.SignalR.Management.csproj" /> | ||
<ProjectReference Include="..\..\src\Microsoft.Azure.SignalR.Common\Microsoft.Azure.SignalR.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(AzureSignalRSDKE2ETest)' == 'true' "> | ||
<PackageReference Include="Microsoft.Azure.SignalR.Management" Version="$(ManagementSDKPackageVersionPrefix)-*" /> | ||
</ItemGroup> | ||
</Project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.SignalR; | ||
using Microsoft.Azure.SignalR.Tests.Common; | ||
|
||
namespace Microsoft.Azure.SignalR.Tests | ||
{ | ||
internal class TestHub : Hub | ||
{ | ||
private TestHubConnectionManager _testHubConnectionManager; | ||
|
||
public TestHub(TestHubConnectionManager testHubConnectionManager) | ||
{ | ||
_testHubConnectionManager = testHubConnectionManager; | ||
} | ||
|
||
public override Task OnConnectedAsync() | ||
{ | ||
_testHubConnectionManager.AddClient(Context.ConnectionId); | ||
_testHubConnectionManager.AddUser(Context.UserIdentifier); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public override Task OnDisconnectedAsync(Exception exception) | ||
{ | ||
_testHubConnectionManager.RemoveClient(Context.ConnectionId); | ||
_testHubConnectionManager.RemoveUser(Context.UserIdentifier); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public void Echo(string message) | ||
{ | ||
Clients.Caller.SendAsync(nameof(Echo), message); | ||
} | ||
|
||
public void SendToClient(string message) | ||
{ | ||
var ind = StaticRandom.Next(0, _testHubConnectionManager.ClientCount); | ||
Clients.Client(_testHubConnectionManager.Clients[ind]).SendAsync(nameof(SendToClient), message); | ||
} | ||
|
||
public void SendToUser(string message) | ||
{ | ||
var ind = StaticRandom.Next(0, _testHubConnectionManager.UserCount); | ||
Clients.User(_testHubConnectionManager.Users[ind]).SendAsync(nameof(SendToUser), message); | ||
} | ||
|
||
public void Broadcast(string message) | ||
{ | ||
Clients.All.SendAsync(nameof(Broadcast), message); | ||
} | ||
|
||
public Task JoinGroup(string groupName) | ||
{ | ||
return Groups.AddToGroupAsync(Context.ConnectionId, groupName); | ||
} | ||
|
||
public Task LeaveGroup(string groupName) | ||
{ | ||
return Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName); | ||
} | ||
|
||
public void SendToGroup(string groupName, string message) | ||
{ | ||
Clients.Group(groupName).SendAsync(nameof(SendToGroup), message); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
62 changes: 0 additions & 62 deletions
62
test/Microsoft.Azure.SignalR.Tests/Infrastructure/TestHub.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,11 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.SignalR; | ||
using Microsoft.Azure.SignalR.Tests.Common; | ||
|
||
namespace Microsoft.Azure.SignalR.Tests | ||
{ | ||
internal class TestHub : Hub | ||
{ | ||
private TestHubConnectionManager _testHubConnectionManager; | ||
|
||
public TestHub(TestHubConnectionManager testHubConnectionManager) | ||
{ | ||
_testHubConnectionManager = testHubConnectionManager; | ||
} | ||
|
||
public override Task OnConnectedAsync() | ||
{ | ||
_testHubConnectionManager.AddClient(Context.ConnectionId); | ||
_testHubConnectionManager.AddUser(Context.UserIdentifier); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public override Task OnDisconnectedAsync(Exception exception) | ||
{ | ||
_testHubConnectionManager.RemoveClient(Context.ConnectionId); | ||
_testHubConnectionManager.RemoveUser(Context.UserIdentifier); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public void Echo(string message) | ||
{ | ||
Clients.Caller.SendAsync(nameof(Echo), message); | ||
} | ||
|
||
public void SendToClient(string message) | ||
{ | ||
var ind = StaticRandom.Next(0, _testHubConnectionManager.ClientCount); | ||
Clients.Client(_testHubConnectionManager.Clients[ind]).SendAsync(nameof(SendToClient), message); | ||
} | ||
|
||
public void SendToUser(string message) | ||
{ | ||
var ind = StaticRandom.Next(0, _testHubConnectionManager.UserCount); | ||
Clients.User(_testHubConnectionManager.Users[ind]).SendAsync(nameof(SendToUser), message); | ||
} | ||
|
||
public void Broadcast(string message) | ||
{ | ||
Clients.All.SendAsync(nameof(Broadcast), message); | ||
} | ||
|
||
public Task JoinGroup(string groupName) | ||
{ | ||
return Groups.AddToGroupAsync(Context.ConnectionId, groupName); | ||
} | ||
|
||
public Task LeaveGroup(string groupName) | ||
{ | ||
return Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName); | ||
} | ||
|
||
public void SendToGroup(string groupName, string message) | ||
{ | ||
Clients.Group(groupName).SendAsync(nameof(SendToGroup), message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters