Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Sindo committed Oct 26, 2020
1 parent bd3cdb0 commit b6c5984
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal void GenerateClientAccessTokenTest(string userId, Claim[] claims, strin
ApplicationName = appName,
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
});
var manager = new ServiceManager(context, null,null);
var manager = new ServiceManager(context, null, null);
var tokenString = manager.GenerateClientAccessToken(HubName, userId, claims, _tokenLifeTime);
var token = JwtTokenHelper.JwtHandler.ReadJwtToken(tokenString);

Expand All @@ -75,40 +75,41 @@ internal void GenerateClientEndpointTest(string appName, string expectedClientEn
ApplicationName = appName,
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
});
var manager = new ServiceManager(context,null,null);
var manager = new ServiceManager(context, null, null);
var clientEndpoint = manager.GetClientEndpoint(HubName);

Assert.Equal(expectedClientEndpoint, clientEndpoint);
}

[Theory/*(Skip = "Reenable when it is ready")*/] //todo
[Theory(Skip = "Reenable when it is ready")]
[MemberData(nameof(TestServiceManagerOptionData))]
internal async Task CreateServiceHubContextTest(ServiceTransportType serviceTransportType, bool useLoggerFacory, string appName, int connectionCount)
{
var context = Options.Create(new ServiceManagerContext
using var builder = new ServiceManagerBuilder();
builder.WithOptions(o =>
{
ServiceTransportType = serviceTransportType,
ApplicationName = appName,
ConnectionCount = connectionCount,
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
o.ServiceTransportType = serviceTransportType;
o.ApplicationName = appName;
o.ConnectionCount = connectionCount;
o.ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) };
});
var serviceManager = new ServiceManager(context, null,null);
var serviceManager = builder.Build();

using (var loggerFactory = useLoggerFacory ? (ILoggerFactory)new LoggerFactory() : NullLoggerFactory.Instance)
{
var hubContext = await serviceManager.CreateHubContextAsync(HubName, loggerFactory);
var hubContext = await serviceManager.CreateHubContextAsync(HubName, default);
}
}

[Fact]
internal async Task IsServiceHealthy_ReturnTrue_Test()
{
var context =Options.Create( new ServiceManagerContext
var context = Options.Create(new ServiceManagerContext
{
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
});
var factory = new TestRestClientFactory(UserAgent, HttpStatusCode.OK);
var serviceManager = new ServiceManager(context, factory,null);
var serviceManager = new ServiceManager(context, factory, null);
var actual = await serviceManager.IsServiceHealthy(default);

Assert.True(actual);
Expand All @@ -125,7 +126,7 @@ internal async Task IsServiceHealthy_ReturnFalse_Test(HttpStatusCode statusCode)
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
});
var factory = new TestRestClientFactory(UserAgent, statusCode);
var serviceManager = new ServiceManager(context, factory,null);
var serviceManager = new ServiceManager(context, factory, null);
var actual = await serviceManager.IsServiceHealthy(default);

Assert.False(actual);
Expand All @@ -143,7 +144,7 @@ internal async Task IsServiceHealthy_Throw_Test(HttpStatusCode statusCode, Type
ServiceEndpoints = new ServiceEndpoint[] { new ServiceEndpoint(_testConnectionString) }
});
var factory = new TestRestClientFactory(UserAgent, statusCode);
var serviceManager = new ServiceManager(context, factory,null);
var serviceManager = new ServiceManager(context, factory, null);

var exception = await Assert.ThrowsAnyAsync<AzureSignalRException>(() => serviceManager.IsServiceHealthy(default));
Assert.IsType(expectedException, exception);
Expand Down

0 comments on commit b6c5984

Please sign in to comment.