示例#1
0
        public void VerifyAcquireTokenAcceptsValidAuthenticationResultTypes()
        {
            InitializeTest();

            var authority   = new Authority(Context);
            var targetUri   = new TargetUri("https://bitbucket.org");
            var credentials = new Credential("a", "b");
            var resultType  = AuthenticationResultType.None;
            var tokenScope  = TokenScope.None;

            var values = Enum.GetValues(typeof(AuthenticationResultType))
                         .Cast <AuthenticationResultType>()
                         .ToList();
            int count = 0;

            values.ToList().ForEach(_ =>
            {
                Task.Run(async() =>
                {
                    Interlocked.Increment(ref count);

                    AuthenticationResult token = await authority.AcquireToken(targetUri, credentials, resultType, tokenScope);

                    Assert.NotNull(token);
                }).Wait();
            });

            Assert.Equal(values.Count, count);
        }
        public void VerifyAcquireTokenAcceptsValidAuthenticationResultTypes()
        {
            var context     = RuntimeContext.Default;
            var authority   = new Authority(context);
            var targetUri   = new TargetUri("https://bitbucket.org");
            var credentials = new Credential("a", "b");
            var resultType  = AuthenticationResultType.None;
            var tokenScope  = Atlassian.Bitbucket.Authentication.TokenScope.None;

            var values = Enum.GetValues(typeof(AuthenticationResultType)).Cast <AuthenticationResultType>();

            values.ToList().ForEach(async _ =>
            {
                var token = await authority.AcquireToken(targetUri, credentials, resultType, tokenScope);

                Assert.NotNull(token);
            });
        }