public void CreateAuthorizingHandlerAuthorization() { var client = new WebServerClient(AuthorizationServerDescription); string bearerToken = "mytoken"; var authorization = new Mock<IAuthorizationState>(); authorization.SetupGet(a => a.AccessToken).Returns(bearerToken); var tcs = new TaskCompletionSource<HttpResponseMessage>(); var expectedResponse = new HttpResponseMessage(); var mockHandler = new DotNetOpenAuth.Test.Mocks.MockHttpMessageHandler((req, ct) => { Assert.That(req.Headers.Authorization.Scheme, Is.EqualTo(Protocol.BearerHttpAuthorizationScheme)); Assert.That(req.Headers.Authorization.Parameter, Is.EqualTo(bearerToken)); tcs.SetResult(expectedResponse); return tcs.Task; }); var applicator = client.CreateAuthorizingHandler(authorization.Object, mockHandler); var httpClient = new HttpClient(applicator); var actualResponse = httpClient.GetAsync("http://localhost/someMessage").Result; Assert.That(actualResponse, Is.SameAs(expectedResponse)); }