public OpenIdAuthenticator_Tests() { var proactiveAuthTokenRefreshInterval = 5.Seconds(); var options = new OpenIdAuthenticationOptions("123", "client_id", proactiveAuthTokenRefreshInterval); openIdMock = new OpenIdClientMock(); authStrategyMock = new AuthenticationStrategyMock(); stopwatchMock = new StopwatchMock(proactiveAuthTokenRefreshInterval); authenticator = new OpenIdAuthenticator(options, openIdMock.Instance, authStrategyMock.Instance, stopwatchMock.StopwatchFactory); }
private void SetupMocks() { var responseMessage = new HttpResponseMessage() { StatusCode = _statusCode, Content = new StreamContent(_outStream) }; HttpMessageHandleMock .Protected() .Setup <Task <HttpResponseMessage> >( "SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>()) .Callback <HttpRequestMessage, CancellationToken>((req, c) => RequestUri = req.RequestUri) .ReturnsAsync(responseMessage) .Verifiable(); MaskinportenClientMock.Setup(_ => _.GetAccessToken(It.IsAny <IEnumerable <string> >())) .ReturnsAsync(new MaskinportenToken("test", 10)); AuthenticationStrategyMock.Setup(_ => _.GetAuthorizationHeaders()) .ReturnsAsync(new Dictionary <string, string>()); }