diff --git a/src/.editorconfig b/src/.editorconfig index 9a433412..417bb343 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -47,7 +47,7 @@ dotnet_diagnostic.CA2227.severity = warning dotnet_diagnostic.IDE0004.severity = warning # IDE0005: Using directive is unnecessary -dotnet_diagnostic.IDE0005.severity = warning +dotnet_diagnostic.IDE0005.severity = error # IDE0008: Use explicit type csharp_style_var_elsewhere = true:suggestion @@ -91,7 +91,7 @@ dotnet_diagnostic.SA1117.severity = none dotnet_diagnostic.SA1122.severity = error # SA1200: Using directive should appear within a namespace declaration -dotnet_diagnostic.SA1200.severity = error +dotnet_diagnostic.SA1200.severity = none # SA1201: Elements should appear in the correct order dotnet_diagnostic.SA1201.severity = none diff --git a/src/GitReleaseManager.Cli/Logging/LogConfiguration.cs b/src/GitReleaseManager.Cli/Logging/LogConfiguration.cs index ff1796a1..b03f0e57 100644 --- a/src/GitReleaseManager.Cli/Logging/LogConfiguration.cs +++ b/src/GitReleaseManager.Cli/Logging/LogConfiguration.cs @@ -1,14 +1,14 @@ +using System.Diagnostics; +using System.Text; +using Destructurama; +using GitReleaseManager.Core.Options; +using Octokit; +using Serilog; +using Serilog.Events; +using Serilog.Sinks.SystemConsole.Themes; + namespace GitReleaseManager.Cli.Logging { - using System.Diagnostics; - using System.Text; - using Destructurama; - using GitReleaseManager.Core.Options; - using Octokit; - using Serilog; - using Serilog.Events; - using Serilog.Sinks.SystemConsole.Themes; - public static class LogConfiguration { private const string CONSOLE_FULL_TEMPLATE = "[{Level:u3}] " + CONSOLE_INFO_TEMPLATE; diff --git a/src/GitReleaseManager.Cli/Program.cs b/src/GitReleaseManager.Cli/Program.cs index 031813e8..9e1cf4a4 100644 --- a/src/GitReleaseManager.Cli/Program.cs +++ b/src/GitReleaseManager.Cli/Program.cs @@ -1,23 +1,23 @@ +using System; +using System.Net; +using System.Reflection; +using System.Threading.Tasks; +using CommandLine; +using GitReleaseManager.Cli.Logging; +using GitReleaseManager.Core; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Configuration; +using GitReleaseManager.Core.Helpers; +using GitReleaseManager.Core.Options; +using GitReleaseManager.Core.Provider; +using GitReleaseManager.Core.ReleaseNotes; +using GitReleaseManager.Core.Templates; +using Microsoft.Extensions.DependencyInjection; +using Octokit; +using Serilog; + namespace GitReleaseManager.Cli { - using System; - using System.Net; - using System.Reflection; - using System.Threading.Tasks; - using CommandLine; - using GitReleaseManager.Cli.Logging; - using GitReleaseManager.Core; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Configuration; - using GitReleaseManager.Core.Helpers; - using GitReleaseManager.Core.Options; - using GitReleaseManager.Core.Provider; - using GitReleaseManager.Core.ReleaseNotes; - using GitReleaseManager.Core.Templates; - using Microsoft.Extensions.DependencyInjection; - using Octokit; - using Serilog; - public static class Program { private static IServiceProvider _serviceProvider; diff --git a/src/GitReleaseManager.Core.Tests/.editorconfig b/src/GitReleaseManager.Core.Tests/.editorconfig new file mode 100644 index 00000000..8572e65f --- /dev/null +++ b/src/GitReleaseManager.Core.Tests/.editorconfig @@ -0,0 +1,4 @@ +root = false + +[*.cs] +dotnet_naming_rule.async_method_should_have_async_suffix.severity = none \ No newline at end of file diff --git a/src/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs index ae785760..43035efe 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/AddAssetsCommandTests.cs @@ -1,14 +1,14 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Collections.Generic; - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class AddAssetsCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs index b0ec5f7b..f9a57c89 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/CloseCommandTests.cs @@ -1,13 +1,13 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class CloseCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/CreateCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/CreateCommandTests.cs index 7d191312..de14eef5 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/CreateCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/CreateCommandTests.cs @@ -1,15 +1,15 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Model; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Collections.Generic; - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Model; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class CreateCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/DiscardCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/DiscardCommandTests.cs index ec248edf..51de6f0c 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/DiscardCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/DiscardCommandTests.cs @@ -1,13 +1,13 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class DiscardCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/ExportCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/ExportCommandTests.cs index 829190c7..9dc9f278 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/ExportCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/ExportCommandTests.cs @@ -1,14 +1,14 @@ +using System.IO; +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.IO; - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class ExportCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/InitCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/InitCommandTests.cs index 0dc975b0..9a587620 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/InitCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/InitCommandTests.cs @@ -1,15 +1,15 @@ +using System.IO; +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Helpers; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.IO; - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Helpers; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class InitCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/LabelCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/LabelCommandTests.cs index 34a7ccee..1762d911 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/LabelCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/LabelCommandTests.cs @@ -1,13 +1,13 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class LabelCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/OpenCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/OpenCommandTests.cs index 2f646fea..21c36538 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/OpenCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/OpenCommandTests.cs @@ -1,13 +1,13 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class OpenCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/PublishCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/PublishCommandTests.cs index d4a4549f..87ebbc98 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/PublishCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/PublishCommandTests.cs @@ -1,13 +1,13 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class PublishCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/Commands/ShowConfigCommandTests.cs b/src/GitReleaseManager.Core.Tests/Commands/ShowConfigCommandTests.cs index b2bcab26..7456af05 100644 --- a/src/GitReleaseManager.Core.Tests/Commands/ShowConfigCommandTests.cs +++ b/src/GitReleaseManager.Core.Tests/Commands/ShowConfigCommandTests.cs @@ -1,14 +1,14 @@ +using System.Threading.Tasks; +using GitReleaseManager.Core.Commands; +using GitReleaseManager.Core.Helpers; +using GitReleaseManager.Core.Options; +using NSubstitute; +using NUnit.Framework; +using Serilog; +using Shouldly; + namespace GitReleaseManager.Core.Tests.Commands { - using System.Threading.Tasks; - using GitReleaseManager.Core.Commands; - using GitReleaseManager.Core.Helpers; - using GitReleaseManager.Core.Options; - using NSubstitute; - using NUnit.Framework; - using Serilog; - using Shouldly; - [TestFixture] public class ShowConfigCommandTests { diff --git a/src/GitReleaseManager.Core.Tests/EnsureTests.cs b/src/GitReleaseManager.Core.Tests/EnsureTests.cs index 4a5bc9f8..91281ff4 100644 --- a/src/GitReleaseManager.Core.Tests/EnsureTests.cs +++ b/src/GitReleaseManager.Core.Tests/EnsureTests.cs @@ -1,10 +1,10 @@ +using System; +using System.IO; +using NUnit.Framework; +using Shouldly; + namespace GitReleaseManager.Core.Tests { - using System; - using System.IO; - using NUnit.Framework; - using Shouldly; - [TestFixture] public class EnsureTests { diff --git a/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs b/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs index 938bd4b9..ad6668b8 100644 --- a/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs +++ b/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs @@ -1,53 +1,53 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using AutoMapper; +using GitReleaseManager.Core.Provider; +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using Octokit; +using Shouldly; +using ApiException = GitReleaseManager.Core.Exceptions.ApiException; +using Issue = GitReleaseManager.Core.Model.Issue; +using IssueComment = GitReleaseManager.Core.Model.IssueComment; +using ItemState = GitReleaseManager.Core.Model.ItemState; +using ItemStateFilter = GitReleaseManager.Core.Model.ItemStateFilter; +using Label = GitReleaseManager.Core.Model.Label; +using Milestone = GitReleaseManager.Core.Model.Milestone; +using NotFoundException = GitReleaseManager.Core.Exceptions.NotFoundException; +using RateLimit = GitReleaseManager.Core.Model.RateLimit; +using Release = GitReleaseManager.Core.Model.Release; +using ReleaseAssetUpload = GitReleaseManager.Core.Model.ReleaseAssetUpload; + namespace GitReleaseManager.Core.Tests.Provider { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Threading.Tasks; - using AutoMapper; - using GitReleaseManager.Core.Provider; - using NSubstitute; - using NSubstitute.ExceptionExtensions; - using NUnit.Framework; - using Octokit; - using Shouldly; - using ApiException = GitReleaseManager.Core.Exceptions.ApiException; - using Issue = GitReleaseManager.Core.Model.Issue; - using IssueComment = GitReleaseManager.Core.Model.IssueComment; - using ItemState = GitReleaseManager.Core.Model.ItemState; - using ItemStateFilter = GitReleaseManager.Core.Model.ItemStateFilter; - using Label = GitReleaseManager.Core.Model.Label; - using Milestone = GitReleaseManager.Core.Model.Milestone; - using NotFoundException = GitReleaseManager.Core.Exceptions.NotFoundException; - using RateLimit = GitReleaseManager.Core.Model.RateLimit; - using Release = GitReleaseManager.Core.Model.Release; - using ReleaseAssetUpload = GitReleaseManager.Core.Model.ReleaseAssetUpload; - [TestFixture] public class GitHubProviderTests { - private const string _owner = "owner"; - private const string _repository = "repository"; - private const string _base = "0.1.0"; - private const string _head = "0.5.0"; - private const int _milestoneNumber = 1; - private const string _milestoneNumberString = "1"; - private const string _milestoneTitle = "0.1.0"; - private const int _issueNumber = 1; - private const string _issueComment = "Issue Comment"; - private const string _labelName = "Label"; - private const string _tagName = "0.1.0"; - private const int _releaseId = 1; - private const int _assetId = 1; - private const string _notFoundMessage = "NotFound"; + private const string OWNER = "owner"; + private const string REPOSITORY = "repository"; + private const string BASE = "0.1.0"; + private const string HEAD = "0.5.0"; + private const int MILESTONE_NUMBER = 1; + private const string MILESTONE_NUMBER_STRING = "1"; + private const string MILESTONE_TITLE = "0.1.0"; + private const int ISSUE_NUMBER = 1; + private const string ISSUE_COMMENT = "Issue Comment"; + private const string LABEL_NAME = "Label"; + private const string TAG_NAME = "0.1.0"; + private const int RELEASE_ID = 1; + private const int ASSET_ID = 1; + private const string NOT_FOUND_MESSAGE = "NotFound"; private readonly Release _release = new Release(); private readonly ReleaseAssetUpload _releaseAssetUpload = new ReleaseAssetUpload(); - private readonly Octokit.NewLabel _newLabel = new Octokit.NewLabel(_labelName, "ffffff"); - private readonly Octokit.NewRelease _newRelease = new Octokit.NewRelease(_tagName); + private readonly Octokit.NewLabel _newLabel = new Octokit.NewLabel(LABEL_NAME, "ffffff"); + private readonly Octokit.NewRelease _newRelease = new Octokit.NewRelease(TAG_NAME); private readonly Exception _exception = new Exception("API Error"); - private readonly Octokit.NotFoundException _notFoundException = new Octokit.NotFoundException(_notFoundMessage, HttpStatusCode.NotFound); + private readonly Octokit.NotFoundException _notFoundException = new Octokit.NotFoundException(NOT_FOUND_MESSAGE, HttpStatusCode.NotFound); private IMapper _mapper; private IGitHubClient _gitHubClient; @@ -65,21 +65,21 @@ public void Setup() [Test] public async Task Should_Delete_Asset() { - _gitHubClient.Repository.Release.DeleteAsset(_owner, _repository, _assetId) + _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromResult); - await _gitHubProvider.DeleteAssetAsync(_owner, _repository, _assetId).ConfigureAwait(false); + await _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID).ConfigureAwait(false); - await _gitHubClient.Repository.Release.Received(1).DeleteAsset(_owner, _repository, _assetId).ConfigureAwait(false); + await _gitHubClient.Repository.Release.Received(1).DeleteAsset(OWNER, REPOSITORY, ASSET_ID).ConfigureAwait(false); } [Test] public async Task Should_Throw_An_Exception_On_Deleting_Asset_For_Non_Existing_Id() { - _gitHubClient.Repository.Release.DeleteAsset(_owner, _repository, _assetId) + _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(_owner, _repository, _assetId)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -87,10 +87,10 @@ public async Task Should_Throw_An_Exception_On_Deleting_Asset_For_Non_Existing_I [Test] public async Task Should_Throw_An_Exception_On_Deleting_Asset() { - _gitHubClient.Repository.Release.DeleteAsset(_owner, _repository, _assetId) + _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(_owner, _repository, _assetId)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -157,34 +157,34 @@ public async Task Should_Get_Commits_Count() { var commitsCount = 12; - _gitHubClient.Repository.Commit.Compare(_owner, _repository, _base, _head) + _gitHubClient.Repository.Commit.Compare(OWNER, REPOSITORY, BASE, HEAD) .Returns(Task.FromResult(new CompareResult(null, null, null, null, null, null, null, null, commitsCount, 0, 0, null, null))); - var result = await _gitHubProvider.GetCommitsCount(_owner, _repository, _base, _head).ConfigureAwait(false); + var result = await _gitHubProvider.GetCommitsCount(OWNER, REPOSITORY, BASE, HEAD).ConfigureAwait(false); result.ShouldBe(commitsCount); - await _gitHubClient.Repository.Commit.Received(1).Compare(_owner, _repository, _base, _head).ConfigureAwait(false); + await _gitHubClient.Repository.Commit.Received(1).Compare(OWNER, REPOSITORY, BASE, HEAD).ConfigureAwait(false); } [Test] public async Task Should_Get_Commits_Count_Zero_If_No_Commits_Found() { - _gitHubClient.Repository.Commit.Compare(_owner, _repository, _base, _head) + _gitHubClient.Repository.Commit.Compare(OWNER, REPOSITORY, BASE, HEAD) .Returns(Task.FromException(_notFoundException)); - var result = await _gitHubProvider.GetCommitsCount(_owner, _repository, _base, _head).ConfigureAwait(false); + var result = await _gitHubProvider.GetCommitsCount(OWNER, REPOSITORY, BASE, HEAD).ConfigureAwait(false); result.ShouldBe(0); - await _gitHubClient.Repository.Commit.Received(1).Compare(_owner, _repository, _base, _head).ConfigureAwait(false); + await _gitHubClient.Repository.Commit.Received(1).Compare(OWNER, REPOSITORY, BASE, HEAD).ConfigureAwait(false); } [Test] public async Task Should_Throw_An_Exception_On_Getting_Commits_Count() { - _gitHubClient.Repository.Commit.Compare(_owner, _repository, _base, _head) + _gitHubClient.Repository.Commit.Compare(OWNER, REPOSITORY, BASE, HEAD) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetCommitsCount(_owner, _repository, _base, _head)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetCommitsCount(OWNER, REPOSITORY, BASE, HEAD)).ConfigureAwait(false); ex.Message.ShouldContain(_exception.Message); ex.InnerException.ShouldBeSameAs(_exception); } @@ -193,7 +193,7 @@ public async Task Should_Throw_An_Exception_On_Getting_Commits_Count() [TestCase("0.5.0", "0.1.0", "https://github.com/owner/repository/compare/0.1.0...0.5.0")] public void Should_Get_Commits_Url(string head, string @base, string expectedResult) { - var result = _gitHubProvider.GetCommitsUrl(_owner, _repository, head, @base); + var result = _gitHubProvider.GetCommitsUrl(OWNER, REPOSITORY, head, @base); result.ShouldBe(expectedResult); } @@ -226,21 +226,21 @@ public static IEnumerable GetCommitsUrl_TestCases() [Test] public async Task Should_Create_Issue_Comment() { - _gitHubClient.Issue.Comment.Create(_owner, _repository, _issueNumber, _issueComment) + _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromResult(new Octokit.IssueComment())); - await _gitHubProvider.CreateIssueCommentAsync(_owner, _repository, _issueNumber, _issueComment).ConfigureAwait(false); + await _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT).ConfigureAwait(false); - await _gitHubClient.Issue.Comment.Received(1).Create(_owner, _repository, _issueNumber, _issueComment).ConfigureAwait(false); + await _gitHubClient.Issue.Comment.Received(1).Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT).ConfigureAwait(false); } [Test] public async Task Should_Throw_An_Exception_On_Creating_Issue_Comment_For_Non_Existing_Issue_Number() { - _gitHubClient.Issue.Comment.Create(_owner, _repository, _issueNumber, _issueComment) + _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(_owner, _repository, _issueNumber, _issueComment)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -248,10 +248,10 @@ public async Task Should_Throw_An_Exception_On_Creating_Issue_Comment_For_Non_Ex [Test] public async Task Should_Throw_An_Exception_On_Creating_Issue_Comment() { - _gitHubClient.Issue.Comment.Create(_owner, _repository, _issueNumber, _issueComment) + _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(_owner, _repository, _issueNumber, _issueComment)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -263,19 +263,19 @@ public async Task Should_Get_Issues_For_Milestone(ItemStateFilter itemStateFilte { var issues = new List(); - _gitHubClient.Issue.GetAllForRepository(_owner, _repository, Arg.Any(), Arg.Any()) + _gitHubClient.Issue.GetAllForRepository(OWNER, REPOSITORY, Arg.Any(), Arg.Any()) .Returns(Task.FromResult((IReadOnlyList)new List())); _mapper.Map>(Arg.Any()) .Returns(issues); - var result = await _gitHubProvider.GetIssuesAsync(_owner, _repository, _milestoneNumber, itemStateFilter).ConfigureAwait(false); + var result = await _gitHubProvider.GetIssuesAsync(OWNER, REPOSITORY, MILESTONE_NUMBER, itemStateFilter).ConfigureAwait(false); result.ShouldBeSameAs(issues); await _gitHubClient.Issue.Received(1).GetAllForRepository( - _owner, - _repository, - Arg.Is(o => o.Milestone == _milestoneNumberString && o.State == (Octokit.ItemStateFilter)itemStateFilter), + OWNER, + REPOSITORY, + Arg.Is(o => o.Milestone == MILESTONE_NUMBER_STRING && o.State == (Octokit.ItemStateFilter)itemStateFilter), Arg.Any()).ConfigureAwait(false); _mapper.ReceivedWithAnyArgs(1).Map>(default); @@ -284,10 +284,10 @@ await _gitHubClient.Issue.Received(1).GetAllForRepository( [Test] public async Task Should_Throw_An_Exception_On_Getting_Issues_For_Non_Existent_Milestone() { - _gitHubClient.Issue.GetAllForRepository(_owner, _repository, Arg.Any(), Arg.Any()) + _gitHubClient.Issue.GetAllForRepository(OWNER, REPOSITORY, Arg.Any(), Arg.Any()) .Returns(Task.FromException>(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssuesAsync(_owner, _repository, 1)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssuesAsync(OWNER, REPOSITORY, 1)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -297,26 +297,26 @@ public async Task Should_Get_Issue_Comments() { var comments = new List(); - _gitHubClient.Issue.Comment.GetAllForIssue(_owner, _repository, _issueNumber, Arg.Any()) + _gitHubClient.Issue.Comment.GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()) .Returns(Task.FromResult((IReadOnlyList)new List())); _mapper.Map>(Arg.Any()) .Returns(comments); - var result = await _gitHubProvider.GetIssueCommentsAsync(_owner, _repository, _issueNumber).ConfigureAwait(false); + var result = await _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER).ConfigureAwait(false); result.ShouldBeSameAs(comments); - await _gitHubClient.Issue.Comment.Received(1).GetAllForIssue(_owner, _repository, _issueNumber, Arg.Any()).ConfigureAwait(false); + await _gitHubClient.Issue.Comment.Received(1).GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()).ConfigureAwait(false); _mapper.Received(1).Map>(Arg.Any()); } [Test] public async Task Should_Throw_An_Exception_On_Getting_Issue_Comments_For_Non_Existing_Issue_Number() { - _gitHubClient.Issue.Comment.GetAllForIssue(_owner, _repository, _issueNumber, Arg.Any()) + _gitHubClient.Issue.Comment.GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()) .Returns(Task.FromException>(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(_owner, _repository, _issueNumber)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -324,10 +324,10 @@ public async Task Should_Throw_An_Exception_On_Getting_Issue_Comments_For_Non_Ex [Test] public async Task Should_Throw_An_Exception_On_Getting_Issue_Comments() { - _gitHubClient.Issue.Comment.GetAllForIssue(_owner, _repository, _issueNumber, Arg.Any()) + _gitHubClient.Issue.Comment.GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()) .Returns(Task.FromException>(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(_owner, _repository, _issueNumber)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -339,12 +339,12 @@ public async Task Should_Create_Label() _mapper.Map(Arg.Any