Ejemplo n.º 1
0
        public Using_integration_with_github_test_organization()
        {
            var options = Substitute.For <IOptions <GitHubAppOptions> >();

            var builder = new ConfigurationBuilder()
                          .AddUserSecrets <Using_integration_with_github_test_organization>();

            Configuration = builder.Build();

            var gitHubAppOptions = new GitHubAppOptions
            {
                ApplicationId  = 0,
                InstallationId = 0,
                Name           = "Subscribe_to_Label",
                PrivateKey     = new PrivateKeyOptions
                {
                    KeyString = null,
                }
            };

            Configuration.Bind("GitHubApp", gitHubAppOptions);

            options.Value.Returns(gitHubAppOptions);

            RepositoryOwner = "rokonec-int-tests";
            RepositoryName  = "issue-notify-tests";
            UserX           = "TestLabelNotifyUserX";
            UserY           = "TestLabelNotifyUserY";
            AreaCat         = "area-cat";
            AreaDog         = "area-dog";

            GitHubClientFactory = new GitHubClientFactory(options);
        }
Ejemplo n.º 2
0
        private static async Task RunAsync(string orgName, string outputFileName, string cacheLocation)
        {
            var isForExcel = outputFileName == null;

            var client = await GitHubClientFactory.CreateAsync();

            var cachedOrg = await CachedOrg.LoadAsync(client, orgName, Console.Out, cacheLocation, forceUpdate : false);

            var csvDocument = new CsvDocument("repo", "repo-state", "repo-last-pushed", "principal-kind", "principal", "permission", "via-team");

            using (var writer = csvDocument.Append())
            {
                foreach (var repo in cachedOrg.Repos)
                {
                    var publicPrivate = repo.IsPrivate ? "private" : "public";
                    var lastPush      = repo.LastPush.ToLocalTime().DateTime.ToString();

                    foreach (var teamAccess in repo.Teams)
                    {
                        var permissions = teamAccess.Permission.ToString().ToLower();
                        var teamName    = teamAccess.Team.Name;
                        var teamUrl     = teamAccess.Team.Url;

                        writer.WriteHyperlink(repo.Url, repo.Name, isForExcel);
                        writer.Write(publicPrivate);
                        writer.Write(lastPush);
                        writer.Write("team");
                        writer.WriteHyperlink(teamUrl, teamName, isForExcel);
                        writer.Write(permissions);
                        writer.Write(teamName);
                        writer.WriteLine();
                    }

                    foreach (var userAccess in repo.Users)
                    {
                        var via         = userAccess.Describe().ToString();
                        var userUrl     = CachedOrg.GetUserUrl(userAccess.UserLogin);
                        var permissions = userAccess.Permission.ToString().ToLower();

                        writer.WriteHyperlink(repo.Url, repo.Name, isForExcel);
                        writer.Write(publicPrivate);
                        writer.Write(lastPush);
                        writer.Write("user");
                        writer.WriteHyperlink(userUrl, userAccess.UserLogin, isForExcel);
                        writer.Write(permissions);
                        writer.Write(via);
                        writer.WriteLine();
                    }
                }
            }

            if (outputFileName == null)
            {
                csvDocument.ViewInExcel();
            }
            else
            {
                csvDocument.Save(outputFileName);
            }
        }
Ejemplo n.º 3
0
        public async Task TestCreateBasicClient()
        {
            var mockApp = new Mock <IAssemblyInformationProvider>();

            mockApp.SetupGet(x => x.ProductInfoHeaderValue).Returns(new ProductInfoHeaderValue("TGSTests", "1.2.3")).Verifiable();

            var mockOptions = new Mock <IOptions <GeneralConfiguration> >();

            var gc = new GeneralConfiguration();

            Assert.IsNull(gc.GitHubAccessToken);
            mockOptions.SetupGet(x => x.Value).Returns(gc);
            var factory = new GitHubClientFactory(mockApp.Object, mockOptions.Object);

            var client = factory.CreateClient();

            Assert.IsNotNull(client);
            var credentials = await client.Connection.CredentialStore.GetCredentials().ConfigureAwait(false);

            Assert.AreEqual(AuthenticationType.Anonymous, credentials.AuthenticationType);

            gc.GitHubAccessToken = "asdfasdfasdfasdfasdfasdf";
            client = factory.CreateClient();
            Assert.IsNotNull(client);
            credentials = await client.Connection.CredentialStore.GetCredentials().ConfigureAwait(false);

            Assert.AreEqual(AuthenticationType.Oauth, credentials.AuthenticationType);

            mockApp.VerifyAll();
        }
        public async Task CreateInstallationClient_InstallationIdProvided_CreatesNewGitHubClientWithCreatedInstallationToken()
        {
            //Arrange
            var fakeGitHubClient = Substitute.For <IGitHubClient>();

            fakeGitHubClient
            .GitHubApps
            .CreateInstallationToken(1337)
            .Returns(new AccessToken("some-token", DateTimeOffset.UtcNow));

            var gitHubClientFactory = new GitHubClientFactory(
                fakeGitHubClient,
                Substitute.For <IFlurlClientFactory>(),
                Substitute.For <IOptionsMonitor <GitHubOptions> >());

            //Act
            var client = await gitHubClientFactory.CreateInstallationClientAsync(1337);

            //Assert
            Assert.IsNotNull(client);

            await fakeGitHubClient
            .GitHubApps
            .Received(1)
            .CreateInstallationToken(1337);
        }
Ejemplo n.º 5
0
        public async Task OnGet()
        {
            if (Number is null || string.IsNullOrEmpty(Repository))
            {
                return;
            }

            var gitHubClient = await GitHubClientFactory.CreateForAppAsync(DotNetUtil.GitHubOrganization, Repository);

            PullRequest = await gitHubClient.PullRequest.Get(DotNetUtil.GitHubOrganization, Repository, Number.Value);

            var builds = await TriageContext
                         .ModelBuilds
                         .Include(x => x.ModelBuildDefinition)
                         .Where(x =>
                                x.GitHubOrganization == DotNetUtil.GitHubOrganization &&
                                x.GitHubRepository == Repository &&
                                x.PullRequestNumber == Number)
                         .OrderByDescending(x => x.BuildNumber)
                         .ToListAsync();

            Builds = builds
                     .Select(b => new PullRequestBuildInfo()
            {
                BuildUri       = b.GetBuildResultInfo().BuildUri,
                BuildNumber    = b.BuildNumber,
                Result         = b.BuildResult ?? BuildResult.None,
                DefinitionUri  = b.ModelBuildDefinition.GetDefinitionInfo().DefinitionUri,
                DefinitionName = b.ModelBuildDefinition.DefinitionName,
            })
                     .ToList();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Reads the contents of a specified blob in the specified GitHub repository.
        /// </summary>
        /// <param name="appConfig">The application configuration object which contains values
        /// for connecting to the specified GitHub repository.</param>
        /// <param name="privateKey"> The RSA private key of a registered GitHub app installed in the specified repository.</param>
        /// <returns>A string value of the blob contents.</returns>
        public static async Task <string> ReadRepositoryBlobContentAsync(ApplicationConfig appConfig, string privateKey)
        {
            if (appConfig == null)
            {
                throw new ArgumentNullException(nameof(appConfig), "Parameter cannot be null");
            }
            if (string.IsNullOrEmpty(privateKey))
            {
                throw new ArgumentNullException(nameof(privateKey), "Parameter cannot be null or empty");
            }

            var gitHubClient = GitHubClientFactory.GetGitHubClient(appConfig, privateKey);

            // Get repo references
            var references = await gitHubClient.Git.Reference.GetAll(appConfig.GitHubOrganization, appConfig.GitHubRepoName);

            // Check if the reference branch is in the refs
            var referenceBranch = references.Where(reference => reference.Ref == $"refs/heads/{appConfig.ReferenceBranch}").FirstOrDefault();

            if (referenceBranch == null)
            {
                throw new ArgumentException(nameof(appConfig.ReferenceBranch), "Branch doesn't exist in the repository");
            }

            // Read from the reference branch
            var fileContents = await gitHubClient.Repository.Content.GetAllContents(
                appConfig.GitHubOrganization,
                appConfig.GitHubRepoName,
                appConfig.FileContentPath);

            return(fileContents.FirstOrDefault()?.Content);
        }
Ejemplo n.º 7
0
        private static async Task <IReadOnlyList <Repository> > RequestReposAsync(GitHubClientFactory factory, GitHubClient client, string org)
        {
            var repos = await RetryOnRateLimiting(factory, client, () => client.Repository.GetAllForOrg(org));

            return(repos.OrderBy(r => r.Name)
                   .Where(r => r.Visibility == RepositoryVisibility.Public)
                   .ToArray());
        }
Ejemplo n.º 8
0
        public void UsesAnonymousCredentialsWhenGitHubTokenIsNotAvailable()
        {
            var factory = new GitHubClientFactory(Options.Create(new WebConfiguration()));

            var client = factory.CreateClient();

            Assert.Equal(Credentials.Anonymous, client.Connection.Credentials);
        }
Ejemplo n.º 9
0
 public Functions(DevOpsServer server, TriageContext context, GitHubClientFactory gitHubClientFactory)
 {
     Server              = server;
     Context             = context;
     TriageContextUtil   = new TriageContextUtil(context);
     GitHubClientFactory = gitHubClientFactory;
     SiteLinkUtil        = SiteLinkUtil.Published;
     HelixServer         = new HelixServer();
 }
Ejemplo n.º 10
0
        private static Task <IReadOnlyList <Milestone> > RequestMilestonesAsync(GitHubClientFactory factory, GitHubClient client, string org, string repo)
        {
            var request = new MilestoneRequest
            {
                State = ItemStateFilter.All
            };

            return(RetryOnRateLimiting(factory, client, () => client.Issue.Milestone.GetAllForRepository(org, repo, request)));
        }
 public GitHubClientWrapper(
     ILogger <GitHubClientWrapper> logger,
     IConfiguration configuration,
     GitHubClientFactory gitHubClientFactory)
 {
     _skipAzureKeyVault   = configuration.GetSection("SkipAzureKeyVault").Get <bool>(); // TODO locally true
     _gitHubClientFactory = gitHubClientFactory;
     _logger = logger;
 }
Ejemplo n.º 12
0
        public void CreatesClient()
        {
            var factory = new GitHubClientFactory(
                Options.Create(new WebConfiguration {
                GitHubToken = "GitHubTestToken"
            }));

            Assert.NotNull(factory.CreateClient());
        }
Ejemplo n.º 13
0
        private async Task Init(long subscriptionId)
        {
            _pullRequests = await _dbContext
                            .PullRequests
                            .AsNoTracking()
                            .Where(q => q.SubscriptionId == subscriptionId &&
                                   q.PullRequestAnalyzeStatus == PullRequestAnalyzeStatus.NotAnalyzed)
                            .OrderBy(q => q.PullRequestInfo.MergedDateTime)
                            .ToArrayAsync();


            _loadMegaInfo = _pullRequests.Length > 100;

            _latestCommitDateTime = await _dbContext
                                    .Commits
                                    .Where(q => q.SubscriptionId == subscriptionId)
                                    .Select(q => q.DateTime)
                                    .MaxAsync();

            _subscription = await _dbContext.Subscriptions.SingleAsync(q => q.Id == subscriptionId);

            if (_gitHubOption != null)
            {
                _installationClient = await GitHubClientFactory.CreateGitHubInstallationClient(_gitHubOption, _subscription.InstallationId);
            }

            if (!_loadMegaInfo)
            {
                return;
            }

            _contributors = await _dbContext
                            .Contributors
                            .AsNoTracking()
                            .Where(q => q.SubscriptionId == subscriptionId && q.GitHubLogin != null).ToDictionaryAsync(q => q.GitHubLogin);

            var fileHistories = await _dbContext
                                .FileHistories
                                .AsNoTracking()
                                .Include(q => q.File)
                                .Where(q => q.SubscriptionId == subscriptionId)
                                .OrderBy(q => q.Contribution.DateTime)
                                .Select(q => new
            {
                q.File, q.OldPath, q.Path
            })
                                .ToArrayAsync();

            _files = new Dictionary <string, File>();

            foreach (var fileHistory in fileHistories)
            {
                _files[fileHistory.Path] = fileHistory.File;
            }
        }
Ejemplo n.º 14
0
        public void GetClient_returns_the_expected_client(string hostName, string expectedBaseAddress)
        {
            // ARRANGE
            var sut = new GitHubClientFactory(new ChangeLogConfiguration());

            // ACT
            var client = sut.CreateClient(hostName);

            // ASSERT
            Assert.Equal(new Uri(expectedBaseAddress), client.Connection.BaseAddress);
        }
Ejemplo n.º 15
0
        public void GetClient_returns_the_expected_client(string hostName, string expectedBaseAddress)
        {
            // ARRANGE
            var sut = new GitHubClientFactory();

            // ACT
            var client = sut.CreateClient(hostName, null);

            // ASSERT
            client.Connection.BaseAddress.Should().Be(new Uri(expectedBaseAddress));
        }
Ejemplo n.º 16
0
        private static Task <IReadOnlyList <Issue> > RequestIssuesAsync(GitHubClientFactory factory, GitHubClient client, string org, string repo, DateTimeOffset?since)
        {
            var issueRequest = new RepositoryIssueRequest()
            {
                SortProperty  = IssueSort.Created,
                SortDirection = SortDirection.Ascending,
                State         = ItemStateFilter.All,
                Since         = since,
            };

            return(RetryOnRateLimiting(factory, client, () => client.Issue.GetAllForRepository(org, repo, issueRequest)));
        }
        public void When_created_with_invalid_credentials_it_should_return_nothing()
        {
            // Arrange
            var accessToken         = "SomeInvalidToken";
            var gitHubClientFactory = new GitHubClientFactory();

            // Act
            IGitHubClient gitHubClient = gitHubClientFactory.Create(accessToken);

            // Assert
            gitHubClient.Should().BeNull();
        }
Ejemplo n.º 18
0
        protected override async Task Execute()
        {
            var installationContext = await GitHubClientFactory.CreateGitHubInstallationClient(_gitHubOption, Subscription.InstallationId);

            var commitAnalyzer = new CommitAnalyzer(Subscription, installationContext.Client);

            var gitCommitTraverser = new CloneBasedGitCommitTraverser(Subscription);
            await gitCommitTraverser.Traverse(commitAnalyzer.AnalayzeCommit);

            await DbContext.Commits.AddRangeAsync(gitCommitTraverser.Commits);

            await DbContext.AddRangeAsync(commitAnalyzer.Contributors);
        }
        /// <summary>
        /// Creates a Pull Request.
        /// </summary>
        /// <param name="appConfig">The application configuration object which contains values
        /// for connecting to the specified GitHub repository.</param>
        /// <param name="privateKey">The RSA private key of a registered GitHub app installed in the specified repository.</param>
        /// <returns>A task.</returns>
        public static async Task CreatePullRequestAsync(ApplicationConfig appConfig, string privateKey)
        {
            if (appConfig == null)
            {
                throw new ArgumentNullException(nameof(appConfig), "Parameter cannot be null");
            }
            if (string.IsNullOrEmpty(privateKey))
            {
                throw new ArgumentNullException(nameof(privateKey), "Parameter cannot be null or empty");
            }

            var gitHubClient = GitHubClientFactory.GetGitHubClient(appConfig, privateKey);

            // Create a PR
            // NB: If the PR already exists, this call will just throw an exception
            var pullRequest =
                await gitHubClient.Repository.PullRequest.Create(appConfig.GitHubOrganization,
                                                                 appConfig.GitHubRepoName,
                                                                 new NewPullRequest(appConfig.PullRequestTitle,
                                                                                    appConfig.WorkingBranch,
                                                                                    appConfig.ReferenceBranch)
                                                                 { Body = appConfig.PullRequestBody });

            // Add PR reviewers
            if (appConfig.Reviewers != null)
            {
                var reviewersResult = await gitHubClient.Repository.PullRequest.ReviewRequest.Create(appConfig.GitHubOrganization,
                                                                                                     appConfig.GitHubRepoName,
                                                                                                     pullRequest.Number,
                                                                                                     new PullRequestReviewRequest(appConfig.Reviewers.AsReadOnly(), null));
            }

            var issueUpdate = new IssueUpdate();

            // Add PR assignee
            appConfig.PullRequestAssignees?.ForEach(assignee => issueUpdate.AddAssignee(assignee));

            // Add PR label
            appConfig.PullRequestLabels?.ForEach(label => issueUpdate.AddLabel(label));

            // Update the PR with the relevant info.
            if (issueUpdate.Assignees?.Count > 0 ||
                issueUpdate.Labels?.Count > 0)
            {
                await gitHubClient.Issue.Update(appConfig.GitHubOrganization,
                                                appConfig.GitHubRepoName,
                                                pullRequest.Number,
                                                issueUpdate);
            }
        }
Ejemplo n.º 20
0
        protected override async Task Execute()
        {
            var cloner = new RepositoryCloner();
            var installationContext = await GitHubClientFactory.CreateGitHubInstallationClient(_gitHubOption, Subscription.InstallationId);

            var token = installationContext.AccessToken.Token;
            var gitHubRepositoryUrl = $"https://*****:*****@github.com/{Subscription.Owner}/{Subscription.Repo}.git";

            var clonePath = Path.Combine(_basePath, $"{Subscription.Owner}-{Subscription.Repo}");

            cloner.Clone(clonePath, gitHubRepositoryUrl);

            Subscription.LocalRepositoryPath = clonePath;
        }
        public void When_created_without_credentials_it_should_return_client_with_anonymous_access()
        {
            // Arrange
            var accessToken         = "";
            var gitHubClientFactory = new GitHubClientFactory();

            // Act
            IGitHubClient gitHubClient = gitHubClientFactory.Create(accessToken);

            // Assert
            gitHubClient.Should().NotBeNull();
            gitHubClient.Connection.As <Connection>().UserAgent.Should().Contain("GitHubSearch");
            gitHubClient.Connection.Credentials.AuthenticationType.Should().Be(AuthenticationType.Anonymous);
        }
Ejemplo n.º 22
0
        private static async Task <T> RetryOnRateLimiting <T>(GitHubClientFactory factory, GitHubClient client, Func <Task <T> > func)
        {
            var retryCount = 3;

            while (true)
            {
                try
                {
                    var result = await func();

                    return(result);
                }
                catch (RateLimitExceededException ex) when(retryCount > 0)
                {
                    var padding = TimeSpan.FromMinutes(2);
                    var delay   = ex.Reset - DateTimeOffset.Now + padding;
                    var time    = ex.Reset + padding;

                    Console.WriteLine($"API rate limit exceeded. Waiting {delay.TotalMinutes:N0} minutes until it resets at {time.ToLocalTime():M/d/yyyy h:mm tt}...");
                    await Task.Delay(delay);

                    Console.WriteLine("Trying again...");
                }
                catch (AuthorizationException ex) when(retryCount > 0)
                {
                    Console.WriteLine($"Authorization error: {ex.Message}. Refreshing token...");
                    await factory.RefreshTokenAsync(client);
                }
                catch (ApiException ex) when(retryCount > 0)
                {
                    var padding = TimeSpan.FromSeconds(30);
                    var delay   = TimeSpan.FromSeconds(30);;
                    var time    = DateTime.UtcNow + delay;

                    Console.WriteLine($"API error: {ex.Message}");
                    Console.WriteLine($"Waiting {delay.TotalMinutes:N0} minutes, until {time.ToLocalTime():M/d/yyyy h:mm tt}...");
                    await Task.Delay(delay);

                    Console.WriteLine("Trying again...");
                }
                catch (OperationCanceledException) when(retryCount > 0)
                {
                    Console.WriteLine($"Operation canceled. Assuming this means a token refresh is needed...");
                    await factory.RefreshTokenAsync(client);
                }

                retryCount--;
            }
        }
Ejemplo n.º 23
0
        public async Task UpdateStatusIssue()
        {
            var gitHubClient = await GitHubClientFactory.CreateForAppAsync("dotnet", "runtime").ConfigureAwait(false);

            var text = await GetStatusIssueTextAsync(gitHubClient).ConfigureAwait(false);

            var issueKey    = new GitHubIssueKey("dotnet", "runtime", 702);
            var issueClient = gitHubClient.Issue;
            var issue       = await issueClient.Get(issueKey.Organization, issueKey.Repository, issueKey.Number).ConfigureAwait(false);

            var updateIssue = issue.ToUpdate();

            updateIssue.Body = text;
            await gitHubClient.Issue.Update(issueKey.Organization, issueKey.Repository, issueKey.Number, updateIssue).ConfigureAwait(false);
        }
Ejemplo n.º 24
0
        public async Task UpdateCommentsAsync()
        {
            var github = GitHubClientFactory.Create();

            foreach (var item in Items)
            {
                var feedback = item.Feedback;

                if (feedback.VideoUrl == null && feedback.FeedbackId != null)
                {
                    var updatedMarkdown = $"[Video]({item.VideoTimeCodeUrl})\n\n{feedback.FeedbackMarkdown}";
                    await github.Issue.Comment.Update(feedback.Owner, feedback.Repo, feedback.FeedbackId.Value, updatedMarkdown);
                }
            }
        }
        public async Task CreateInstallationInitiatorClient_NoPullDogOptionsFound_ThrowsException()
        {
            //Arrange
            var gitHubClientFactory = new GitHubClientFactory(
                Substitute.For <IGitHubClient>(),
                Substitute.For <IFlurlClientFactory>(),
                Substitute.For <IOptionsMonitor <GitHubOptions> >());

            //Act
            var exception = await Assert.ThrowsExceptionAsync <InvalidOperationException>(async() =>
                                                                                          await gitHubClientFactory.CreateInstallationInitiatorClientAsync("dummy"));

            //Assert
            Assert.IsNotNull(exception);
        }
Ejemplo n.º 26
0
        public async Task <IGitHubClient?> TryCreateForIssue(GitHubIssueKey issueKey)
        {
            try
            {
                var gitHubClient = await GitHubClientFactory.CreateForAppAsync(
                    issueKey.Organization,
                    issueKey.Repository).ConfigureAwait(false);

                return(gitHubClient);
            }
            catch (Exception ex)
            {
                Logger.LogError($"Cannot create GitHubClient for {issueKey.Organization} {issueKey.Repository}: {ex.Message}");
                return(null);
            }
        }
Ejemplo n.º 27
0
        public void CreateClient_adds_an_access_token_if_token_if_a_value_is_supplied()
        {
            // ARRANGE
            var sut = new GitHubClientFactory();

            // ACT
            var client = sut.CreateClient("github.com", "some-access-token");

            // ASSERT
            var clientConcrete = client
                                 .Should().NotBeNull()
                                 .And.BeAssignableTo <GitHubClient>()
                                 .Which;

            clientConcrete.Credentials.AuthenticationType.Should().Be(AuthenticationType.Oauth);
            clientConcrete.Credentials.Login.Should().BeNull();
            clientConcrete.Credentials.Password.Should().Be("some-access-token");
        }
Ejemplo n.º 28
0
        public void CreateClient_succeeds_if_no_access_token_is_supplied(string accessToken)
        {
            // ARRANGE
            var sut = new GitHubClientFactory();

            // ACT
            var client = sut.CreateClient("github.com", accessToken);

            // ASSERT
            var clientConcrete = client
                                 .Should().NotBeNull()
                                 .And.BeAssignableTo <GitHubClient>()
                                 .Which;

            clientConcrete.Credentials.AuthenticationType.Should().Be(AuthenticationType.Anonymous);
            clientConcrete.Credentials.Login.Should().BeNull();
            clientConcrete.Credentials.Password.Should().BeNull();
        }
Ejemplo n.º 29
0
        public void Start(Action <Action <IPluginRegistration> > pluginRegistra)
        {
            pluginRegistra(r =>
            {
                var assembly            = typeof(GitHubPluginBootstrapper).Assembly;
                var gitHubClientFactory = new GitHubClientFactory(r.ConfigApi);
                var gitHubService       = new GitHubService(gitHubClientFactory);

                r.SetPluginInformation(PluginInformation.With(
                                           PluginId.From(assembly),
                                           PluginTitle.With("GitHub"),
                                           PluginVersion.From(assembly),
                                           PluginDescription.With("Provides GitHub support for the Borg"),
                                           r.Uri));
                r.RegisterHttpApi(new GitHubApi(r.MessageApi, gitHubService));
                r.RegisterHttpApiCommands();
            });
        }
        public async Task TestCreateBasicClient()
        {
            var mockApp = new Mock <IAssemblyInformationProvider>();

            mockApp.SetupGet(x => x.ProductInfoHeaderValue).Returns(new ProductInfoHeaderValue("TGSTests", "1.2.3")).Verifiable();

            var factory = new GitHubClientFactory(mockApp.Object);

            var client = factory.CreateClient();

            Assert.IsNotNull(client);
            var credentials = await client.Connection.CredentialStore.GetCredentials().ConfigureAwait(false);

            Assert.AreEqual(AuthenticationType.Anonymous, credentials.AuthenticationType);


            mockApp.VerifyAll();
        }