Пример #1
0
        public async Task ExchangeAuthCodeForClaimsIdentity_ExchangesCodeForIdentity()
        {
            var options = new AuthServerOptions()
            {
                AuthorizationUrl = "http://localhost/tokenUrl"
            };
            var exchanger = new TokenExchanger(options, GetMockHttpClient());

            var identity = await exchanger.ExchangeAuthCodeForClaimsIdentity("goodCode");

            Assert.IsType <ClaimsIdentity>(identity);
        }
Пример #2
0
        public async Task ExchangeAuthCodeForClaimsIdentity_ReturnsNullOnFailure()
        {
            var options = new AuthServerOptions()
            {
                AuthorizationUrl = "http://localhost/tokenUrl"
            };
            var httpClient = new object(); // TODO: replace with mock that does stuff
            var exchanger  = new TokenExchanger(options, GetMockHttpClient());

            var identity = await exchanger.ExchangeAuthCodeForClaimsIdentity("badCode");

            Assert.Null(identity);
        }