38 lines
833 B
C#
38 lines
833 B
C#
using Microsoft.AspNetCore.SignalR.Client;
|
|
using static System.Net.WebRequestMethods;
|
|
using static Microsoft.AspNetCore.Http.StatusCodes;
|
|
|
|
namespace ExampleSignalR.Test;
|
|
|
|
public class UnitTest1 : BaseIntegrationTest
|
|
{
|
|
private readonly HttpClient _httpClient;
|
|
public UnitTest1(WebAppFactoryFixture factory) : base(factory)
|
|
{
|
|
_httpClient = factory.CreateClient();
|
|
}
|
|
|
|
[Fact]
|
|
public async void ConnectToSignalRHub()
|
|
{
|
|
var hubConnection = new HubConnectionBuilder()
|
|
.WithUrl($"{factory.url}/chatHub") // ...appsettings.json
|
|
.Build();
|
|
|
|
|
|
await hubConnection.StartAsync();
|
|
}
|
|
|
|
//public async Task Connect()
|
|
//{
|
|
// try
|
|
// {
|
|
// await hubConnection.StartAsync();
|
|
// Console.WriteLine("×àò ïîäêëþ÷åí...");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Console.WriteLine($"Îøèáêà ïîäêëþ÷åíèÿ: {ex.Message}");
|
|
// }
|
|
//}
|
|
} |