public void Test_Authentication()
        {
            var handler       = new MockAuthenticationMessageHandler();
            var authenticator = new Authenticator();

            using (var service = new MockClientService(new BaseClientService.Initializer()
            {
                HttpClientFactory = new MockHttpClientFactory(handler),
                Authenticator = authenticator
            }))
            {
                var response = service.HttpClient.SendAsync(
                    new HttpRequestMessage(HttpMethod.Get, "https://test")).Result;
                // the authenticator doesn't implement unsuccessful response handler, so the request fails
                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
                Assert.That(handler.Calls, Is.EqualTo(1));
                Assert.That(authenticator.ApplyCalls, Is.EqualTo(1));
            }
        }
        public void Test_Authentication_UnsuccessfulHandler()
        {
            var handler       = new MockAuthenticationMessageHandler();
            var authenticator = new AuthenticatorUnsuccessfulHandler();

            using (var service = new MockClientService(new BaseClientService.Initializer()
            {
                HttpClientFactory = new MockHttpClientFactory(handler),
                Authenticator = authenticator
            }))
            {
                var response = service.HttpClient.SendAsync(
                    new HttpRequestMessage(HttpMethod.Get, "https://test")).Result;
                // the authenticator handles unsuccessful response handler by "refreshing" the token, so the request
                // will success
                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
                Assert.That(handler.Calls, Is.EqualTo(2));
                Assert.That(authenticator.ApplyCalls, Is.EqualTo(2));
                Assert.That(authenticator.HandleCalls, Is.EqualTo(1));
            }
        }