Exemplo n.º 1
0
        public void CanCreateCredentials()
        {
            var tokenProviderFactory = new Mock <IJwtTokenProviderFactory>();
            var sut = new ManagedIdentityServiceClientCredentialsFactory(TestAppId, tokenProviderFactory.Object);

            var credentials = sut.CreateCredentialsAsync(
                TestAppId, TestAudience, "https://login.microsoftonline.com", true, CancellationToken.None);

            Assert.NotNull(credentials);
        }
Exemplo n.º 2
0
        public void CannotCreateCredentialsWithInvalidAppId()
        {
            var tokenProviderFactory = new Mock <IJwtTokenProviderFactory>();
            var sut = new ManagedIdentityServiceClientCredentialsFactory(TestAppId, tokenProviderFactory.Object);

            Assert.Throws <InvalidOperationException>(() =>
            {
                _ = sut.CreateCredentialsAsync(
                    "InvalidAppId", TestAudience, "https://login.microsoftonline.com", true, CancellationToken.None);
            });
        }