Ejemplo n.º 1
0
        public void TestGetToken()
        {
            IIdentityProvider provider = new CloudIdentityProvider(Bootstrapper.Settings.TestIdentity);

            IdentityToken token = provider.GetToken();
            Assert.IsNotNull(token);

            // ensure the provider is caching the access token
            IdentityToken cachedToken = provider.GetToken();
            Assert.AreSame(token, cachedToken);

            // ensure that the provider refreshes the token upon request
            IdentityToken newToken = provider.GetToken(forceCacheRefresh: true);
            Assert.AreNotSame(token, newToken);

            // ensure the the refresh was applied to the cache
            IdentityToken newCachedToken = provider.GetToken();
            Assert.AreSame(newToken, newCachedToken);
        }