public async Task BreakerTest() { //ARRANGE var validator = new BackchannelCertificateValidatorMock(() => true); var webClient = new HttpDocumentRetrieverMock(validator); var manager = new StateManager(new TimeManager(), new StateProviderMock()); BreakerProxy.StateProviderFactory(() => manager); var breaker = BreakerProxy.Instance; var result = String.Empty; var executingContext = new BreakerExecutionContext { Action = () => throw new NotImplementedException() }; //ACT var response = await breaker.Execute(executingContext); //ASSERT }
public async Task BreakerTest2() { //ARRANGE var validator = new BackchannelCertificateValidatorMock(() => true); var webClient = new HttpDocumentRetrieverMock(validator); var manager = new StateManager(new TimeManager(), new StateProviderMock()); BreakerProxy.StateProviderFactory(() => manager); var breaker = BreakerProxy.Instance; var executingContext = new BreakerExecutionContext { Action = () => webClient.GetDocumentAsync("https://dg-mfb/idp/shibboleth", CancellationToken.None) }; //ACT var response = await breaker.Execute(executingContext); response = await breaker.Execute(executingContext); Thread.Sleep(8000); response = await breaker.Execute(executingContext); //ASSERT }
public async Task WsFederationConfigurationRetrieverTest() { //ARRANGE var logger = new LogProviderMock(); var bckChannelcertValidator = new CertificateValidatorMock(); var documentRetrieer = new HttpDocumentRetrieverMock(bckChannelcertValidator); var configurationProvider = new CertificateValidationConfigurationProvider(); var certValidator = new CertificateValidator(configurationProvider, logger); var serialiser = new FederationMetadataSerialiser(certValidator, logger); var configurationRetriever = new WsFederationConfigurationRetriever(_ => documentRetrieer, serialiser); //ACT var context = new FederationPartyConfiguration("local", "https://localhost"); var baseMetadata = await configurationRetriever.GetAsync(context, new CancellationToken()); var metadata = baseMetadata as EntityDescriptor; //ASSERT Assert.IsTrue(metadata != null); Assert.AreEqual(1, metadata.RoleDescriptors.Count); }