public void ValidateCtorNoOptions()
        {
            var cred = new DefaultAzureCredential();

            IExtendedTokenCredential[] sources = cred._sources();

            Assert.NotNull(sources);
            Assert.AreEqual(sources.Length, 4);
            Assert.IsInstanceOf(typeof(EnvironmentCredential), sources[0]);
            Assert.IsInstanceOf(typeof(ManagedIdentityCredential), sources[1]);
            Assert.IsInstanceOf(typeof(SharedTokenCacheCredential), sources[2]);
            Assert.IsNull(sources[3]);
        }
        public void ValidateCtorNoOptions()
        {
            var cred = new DefaultAzureCredential();

            TokenCredential[] sources = cred._sources();

            Assert.NotNull(sources);
            Assert.AreEqual(sources.Length, 7);
            Assert.IsInstanceOf(typeof(EnvironmentCredential), sources[0]);
            Assert.IsInstanceOf(typeof(ManagedIdentityCredential), sources[1]);
            Assert.IsInstanceOf(typeof(VisualStudioCredential), sources[2]);
            Assert.IsInstanceOf(typeof(VisualStudioCodeCredential), sources[3]);
            Assert.IsInstanceOf(typeof(AzureCliCredential), sources[4]);
            Assert.IsNull(sources[6]);
        }
        public void ValidateCtorIncludedInteractiveParam([Values(true, false)] bool includeInteractive)
        {
            var cred = new DefaultAzureCredential(includeInteractive);

            IExtendedTokenCredential[] sources = cred._sources();

            Assert.NotNull(sources);
            Assert.AreEqual(sources.Length, 4);
            Assert.IsInstanceOf(typeof(EnvironmentCredential), sources[0]);
            Assert.IsInstanceOf(typeof(ManagedIdentityCredential), sources[1]);
            Assert.IsInstanceOf(typeof(SharedTokenCacheCredential), sources[2]);

            if (includeInteractive)
            {
                Assert.IsInstanceOf(typeof(InteractiveBrowserCredential), sources[3]);
            }
            else
            {
                Assert.IsNull(sources[3]);
            }
        }
Example #4
0
        public void ValidateCtorIncludedInteractiveParam([Values(true, false)] bool includeInteractive)
        {
            var cred = new DefaultAzureCredential(includeInteractive);

            TokenCredential[] sources = cred._sources();

            Assert.NotNull(sources);
            Assert.AreEqual(sources.Length, 8);
            Assert.IsInstanceOf(typeof(EnvironmentCredential), sources[0]);
            Assert.IsInstanceOf(typeof(ManagedIdentityCredential), sources[1]);
            Assert.IsInstanceOf(typeof(VisualStudioCredential), sources[2]);
            Assert.IsInstanceOf(typeof(VisualStudioCodeCredential), sources[3]);
            Assert.IsInstanceOf(typeof(AzureCliCredential), sources[4]);
            Assert.IsInstanceOf(typeof(AzurePowerShellCredential), sources[5]);

            if (includeInteractive)
            {
                Assert.IsInstanceOf(typeof(InteractiveBrowserCredential), sources[6]);
            }
            else
            {
                Assert.IsNull(sources[6]);
            }
        }