Skip to content

Commit

Permalink
test: imporving
Browse files Browse the repository at this point in the history
  • Loading branch information
aguacongas committed Oct 11, 2020
1 parent 5b12f67 commit 0b765ac
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public async Task Subscribe_should_subcribe_to_hub_events()

var configuration = new Dictionary<string, string>
{
["ConnectionStrings:DefaultConnection"] = Guid.NewGuid().ToString(),
["ApiAuthentication:Authority"] = "http://localhost",
["SignalR:HubUrl"] = "http://localhost/providerhub",
["SignalR:UseMessagePack"] = "false",
Expand Down Expand Up @@ -77,6 +78,11 @@ public async Task Subscribe_should_subcribe_to_hub_events()
var wrapper1 = new KeyManagerWrapper<Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor>(new Mock<IKeyManager>().Object, new Mock<IDefaultKeyResolver>().Object, new Mock<IProviderClient>().Object);
var wrapper2 = new KeyManagerWrapper<IdentityServer.KeysRotation.RsaEncryptorDescriptor>(new Mock<IKeyManager>().Object, new Mock<IDefaultKeyResolver>().Object, new Mock<IProviderClient>().Object);
var hubConnectionFactory = new HubConnectionFactory(provider.GetRequiredService<IConfiguration>(), provider, new NullLogger<HubConnectionFactory>());

var connection = hubConnectionFactory.GetConnection(default);
Assert.NotNull(connection);
await hubConnectionFactory.StartConnectionAsync(default);

var subscriber = new SchemeChangeSubscriber<SchemeDefinition>(hubConnectionFactory, manager, new Mock<IDynamicProviderStore<SchemeDefinition>>().Object, wrapper1, wrapper2, new NullLogger<SchemeChangeSubscriber<SchemeDefinition>>());
await subscriber.SubscribeAsync(default).ConfigureAwait(false);

Expand All @@ -89,7 +95,9 @@ public async Task Subscribe_should_subcribe_to_hub_events()
SerializedOptions = serializer.SerializeOptions(new GoogleOptions(), typeof(GoogleOptions))
};

await Task.Delay(500).ConfigureAwait(false);
var result = waitHandle.WaitOne(5000);

Assert.True(result);

await store.CreateAsync(extProvider).ConfigureAwait(false);
await store.UpdateAsync(extProvider).ConfigureAwait(false);
Expand Down

0 comments on commit 0b765ac

Please sign in to comment.