Beispiel #1
0
        public void CreateAndCheckPropertiesWith200()
        {
            var result = new AddChallengeOnUnauthorizedResult(new AuthenticationHeaderValue("scheme"), new OkResult(new HttpRequestMessage()));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Challenge, Is.Not.Null);
            Assert.That(result.InnerResult, Is.Not.Null);

            var response = result.ExecuteAsync(new CancellationToken()).Result;

            Assert.That(response, Is.Not.Null);
            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
Beispiel #2
0
        public void CreateAndCheckPropertiesWith401()
        {
            var result = new AddChallengeOnUnauthorizedResult(new AuthenticationHeaderValue("scheme"),
                                                              new UnauthorizedResult(
                                                                  new List <AuthenticationHeaderValue>(),
                                                                  new TokenController()
            {
                Request = new HttpRequestMessage(HttpMethod.Get, "http://localhost")
            }));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Challenge, Is.Not.Null);
            Assert.That(result.InnerResult, Is.Not.Null);

            var response = result.ExecuteAsync(new CancellationToken()).Result;

            Assert.That(response, Is.Not.Null);
            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
        }