< Summary

Class:ApplicationCore.GitHubClientFactory
Assembly:ApplicationCore
File(s):C:\Users\Teknikaali\Source\Repos\jekyll-blog-comments\ApplicationCore\Services\PullRequest\GitHubClientFactory.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:26
Line coverage:100% (12 of 12)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)

Coverage History

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
.ctor(...)20100%100%
CreateClient()20100%100%

File(s)

C:\Users\Teknikaali\Source\Repos\jekyll-blog-comments\ApplicationCore\Services\PullRequest\GitHubClientFactory.cs

#LineLine coverage
 1using System;
 2using Octokit;
 3
 4namespace ApplicationCore
 5{
 6    public class GitHubClientFactory : IGitHubClientFactory
 7    {
 8        private readonly GitHubConfig _config;
 9
 510        public GitHubClientFactory(GitHubConfig config)
 511        {
 512            _config = config ?? throw new ArgumentNullException(nameof(config));
 413        }
 14
 15        public IGitHubClient CreateClient()
 416        {
 417            var credentials = _config.Token.Length > 0
 418                ? new Credentials(_config.Token)
 419                : Credentials.Anonymous;
 20
 421            return new GitHubClient(
 422                new ProductHeaderValue("PostCommentToPullRequest"),
 423                new Octokit.Internal.InMemoryCredentialStore(credentials));
 424        }
 25    }
 26}