diff --git a/src/GitReleaseManager.Cli/Program.cs b/src/GitReleaseManager.Cli/Program.cs index fdc36e1a..dc44e89c 100644 --- a/src/GitReleaseManager.Cli/Program.cs +++ b/src/GitReleaseManager.Cli/Program.cs @@ -8,11 +8,13 @@ using GitReleaseManager.Core.Commands; using GitReleaseManager.Core.Configuration; using GitReleaseManager.Core.Helpers; +using GitReleaseManager.Core.Model; using GitReleaseManager.Core.Options; using GitReleaseManager.Core.Provider; using GitReleaseManager.Core.ReleaseNotes; using GitReleaseManager.Core.Templates; using Microsoft.Extensions.DependencyInjection; +using NGitLab; using Octokit; using Serilog; @@ -96,7 +98,6 @@ private static void RegisterServices(BaseSubOptions options) .AddSingleton(fileSystem) .AddSingleton() .AddSingleton() - .AddSingleton() .AddSingleton(); if (options is BaseVcsOptions vcsOptions) @@ -106,9 +107,7 @@ private static void RegisterServices(BaseSubOptions options) throw new Exception("The token option is not defined"); } - var gitHubClient = new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) }; - serviceCollection = serviceCollection - .AddSingleton(gitHubClient); + RegisterVcsProvider(vcsOptions, serviceCollection); } serviceCollection = serviceCollection @@ -197,5 +196,23 @@ private static Task ExecuteCommand(TOptions options) private static void LogOptions(BaseSubOptions options) => Log.Debug("{@Options}", options); + + private static void RegisterVcsProvider(BaseVcsOptions vcsOptions, IServiceCollection serviceCollection) + { + Log.Information("Using {Provider} as VCS Provider", vcsOptions.Provider); + if (vcsOptions.Provider == VcsProvider.GitLab) + { + serviceCollection + .AddSingleton((_) => new GitLabClient("https://gitlab.com", vcsOptions.Token)) + .AddSingleton(); + } + else + { + // default to Github + serviceCollection + .AddSingleton((_) => new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) }) + .AddSingleton(); + } + } } } \ No newline at end of file diff --git a/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs b/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs index 501300cf..a9e1c563 100644 --- a/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs +++ b/src/GitReleaseManager.Core.Tests/Provider/GitHubProviderTests.cs @@ -20,6 +20,7 @@ using NotFoundException = GitReleaseManager.Core.Exceptions.NotFoundException; using RateLimit = GitReleaseManager.Core.Model.RateLimit; using Release = GitReleaseManager.Core.Model.Release; +using ReleaseAsset= GitReleaseManager.Core.Model.ReleaseAsset; using ReleaseAssetUpload = GitReleaseManager.Core.Model.ReleaseAssetUpload; namespace GitReleaseManager.Core.Tests.Provider @@ -31,7 +32,8 @@ public class GitHubProviderTests 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 int MILESTONE_PUBLIC_NUMBER = 1; + private const int MILESTONE_INTERNAL_NUMBER = 123; private const string MILESTONE_NUMBER_STRING = "1"; private const string MILESTONE_TITLE = "0.1.0"; private const int ISSUE_NUMBER = 1; @@ -43,7 +45,11 @@ public class GitHubProviderTests private const string NOT_FOUND_MESSAGE = "NotFound"; private const bool SKIP_PRERELEASES = false; - private readonly Release _release = new Release(); + private readonly Release _release = new Release { Id = RELEASE_ID }; + private readonly Issue _issue = new Issue { PublicNumber = ISSUE_NUMBER }; + private readonly Milestone _milestone = new Milestone { PublicNumber = MILESTONE_PUBLIC_NUMBER, InternalNumber = MILESTONE_INTERNAL_NUMBER }; + private readonly Label _label = new Label { Name = LABEL_NAME }; + private readonly ReleaseAsset _asset = new ReleaseAsset { Id = ASSET_ID }; private readonly ReleaseAssetUpload _releaseAssetUpload = new ReleaseAssetUpload(); private readonly Octokit.NewLabel _newLabel = new Octokit.NewLabel(LABEL_NAME, "ffffff"); private readonly Octokit.NewRelease _newRelease = new Octokit.NewRelease(TAG_NAME); @@ -69,7 +75,7 @@ public async Task Should_Delete_Asset() _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromResult); - await _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID).ConfigureAwait(false); + await _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, _asset).ConfigureAwait(false); await _gitHubClient.Repository.Release.Received(1).DeleteAsset(OWNER, REPOSITORY, ASSET_ID).ConfigureAwait(false); } @@ -80,7 +86,7 @@ public async Task Should_Throw_An_Exception_On_Deleting_Asset_For_Non_Existing_I _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, _asset)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -91,7 +97,7 @@ public async Task Should_Throw_An_Exception_On_Deleting_Asset() _gitHubClient.Repository.Release.DeleteAsset(OWNER, REPOSITORY, ASSET_ID) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, ASSET_ID)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteAssetAsync(OWNER, REPOSITORY, _asset)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -230,7 +236,7 @@ public async Task Should_Create_Issue_Comment() _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromResult(new Octokit.IssueComment())); - await _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT).ConfigureAwait(false); + await _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, _issue, ISSUE_COMMENT).ConfigureAwait(false); await _gitHubClient.Issue.Comment.Received(1).Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT).ConfigureAwait(false); } @@ -241,7 +247,7 @@ public async Task Should_Throw_An_Exception_On_Creating_Issue_Comment_For_Non_Ex _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, _issue, ISSUE_COMMENT)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -252,7 +258,7 @@ public async Task Should_Throw_An_Exception_On_Creating_Issue_Comment() _gitHubClient.Issue.Comment.Create(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, ISSUE_NUMBER, ISSUE_COMMENT)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.CreateIssueCommentAsync(OWNER, REPOSITORY, _issue, ISSUE_COMMENT)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -270,7 +276,7 @@ public async Task Should_Get_Issues_For_Milestone(ItemStateFilter itemStateFilte _mapper.Map>(Arg.Any()) .Returns(issues); - var result = await _gitHubProvider.GetIssuesAsync(OWNER, REPOSITORY, MILESTONE_NUMBER, itemStateFilter).ConfigureAwait(false); + var result = await _gitHubProvider.GetIssuesAsync(OWNER, REPOSITORY, _milestone, itemStateFilter).ConfigureAwait(false); result.ShouldBeSameAs(issues); await _gitHubClient.Issue.Received(1).GetAllForRepository( @@ -288,7 +294,7 @@ public async Task Should_Throw_An_Exception_On_Getting_Issues_For_Non_Existent_M _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, _milestone)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -304,7 +310,7 @@ public async Task Should_Get_Issue_Comments() _mapper.Map>(Arg.Any()) .Returns(comments); - var result = await _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER).ConfigureAwait(false); + var result = await _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, _issue).ConfigureAwait(false); result.ShouldBeSameAs(comments); await _gitHubClient.Issue.Comment.Received(1).GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()).ConfigureAwait(false); @@ -317,7 +323,7 @@ public async Task Should_Throw_An_Exception_On_Getting_Issue_Comments_For_Non_Ex _gitHubClient.Issue.Comment.GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()) .Returns(Task.FromException>(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, _issue)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -328,7 +334,7 @@ public async Task Should_Throw_An_Exception_On_Getting_Issue_Comments() _gitHubClient.Issue.Comment.GetAllForIssue(OWNER, REPOSITORY, ISSUE_NUMBER, Arg.Any()) .Returns(Task.FromException>(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, ISSUE_NUMBER)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.GetIssueCommentsAsync(OWNER, REPOSITORY, _issue)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -371,7 +377,7 @@ public async Task Should_Delete_Label() _gitHubClient.Issue.Labels.Delete(OWNER, REPOSITORY, LABEL_NAME) .Returns(Task.FromResult); - await _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, LABEL_NAME).ConfigureAwait(false); + await _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, _label).ConfigureAwait(false); await _gitHubClient.Issue.Labels.Received(1).Delete(OWNER, REPOSITORY, LABEL_NAME).ConfigureAwait(false); } @@ -382,7 +388,7 @@ public async Task Should_Throw_An_Exception_On_Deleting_Label_For_Non_Existing_L _gitHubClient.Issue.Labels.Delete(OWNER, REPOSITORY, LABEL_NAME) .Returns(Task.FromException>(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, LABEL_NAME)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, _label)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -393,7 +399,7 @@ public async Task Should_Throw_An_Exception_On_Deleting_Label() _gitHubClient.Issue.Labels.Delete(OWNER, REPOSITORY, LABEL_NAME) .Returns(Task.FromException>(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, LABEL_NAME)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteLabelAsync(OWNER, REPOSITORY, _label)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } @@ -508,21 +514,21 @@ public async Task Should_Throw_An_Exception_On_Getting_Milestones() [TestCase(ItemState.Open)] public async Task Should_Set_Milestone_State(ItemState itemState) { - _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_NUMBER, Arg.Any()) + _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_PUBLIC_NUMBER, Arg.Any()) .Returns(Task.FromResult(new Octokit.Milestone())); - await _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, MILESTONE_NUMBER, itemState).ConfigureAwait(false); + await _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, _milestone, itemState).ConfigureAwait(false); - await _gitHubClient.Issue.Milestone.Received(1).Update(OWNER, REPOSITORY, MILESTONE_NUMBER, Arg.Is(o => o.State == (Octokit.ItemState)itemState)).ConfigureAwait(false); + await _gitHubClient.Issue.Milestone.Received(1).Update(OWNER, REPOSITORY, MILESTONE_PUBLIC_NUMBER, Arg.Is(o => o.State == (Octokit.ItemState)itemState)).ConfigureAwait(false); } [Test] public async Task Should_Throw_An_Exception_On_Setting_Milestone_State_For_Non_Existent_Number() { - _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_NUMBER, Arg.Any()) + _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_PUBLIC_NUMBER, Arg.Any()) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, MILESTONE_NUMBER, ItemState.Closed)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, _milestone, ItemState.Closed)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBeSameAs(_notFoundException); } @@ -530,10 +536,10 @@ public async Task Should_Throw_An_Exception_On_Setting_Milestone_State_For_Non_E [Test] public async Task Should_Throw_An_Exception_On_Setting_Milestone_State() { - _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_NUMBER, Arg.Any()) + _gitHubClient.Issue.Milestone.Update(OWNER, REPOSITORY, MILESTONE_PUBLIC_NUMBER, Arg.Any()) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, MILESTONE_NUMBER, ItemState.Closed)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.SetMilestoneStateAsync(OWNER, REPOSITORY, _milestone, ItemState.Closed)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBeSameAs(_exception); } @@ -581,25 +587,21 @@ public async Task Should_Throw_An_Exception_On_Creating_Release() [Test] public async Task Should_Delete_Release() { - var id = 1; - - _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, id) + _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, RELEASE_ID) .Returns(Task.CompletedTask); - await _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, id).ConfigureAwait(false); + await _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, _release).ConfigureAwait(false); - await _gitHubClient.Repository.Release.Received(1).Delete(OWNER, REPOSITORY, id).ConfigureAwait(false); + await _gitHubClient.Repository.Release.Received(1).Delete(OWNER, REPOSITORY, RELEASE_ID).ConfigureAwait(false); } [Test] public async Task Should_Throw_An_Exception_On_Deleting_Release_For_Non_Existent_Id() { - var id = 1; - - _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, id) + _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, RELEASE_ID) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, id)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, _release)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBeSameAs(_notFoundException); } @@ -607,12 +609,10 @@ public async Task Should_Throw_An_Exception_On_Deleting_Release_For_Non_Existent [Test] public async Task Should_Throw_An_Exception_On_Deleting_Release() { - var id = 1; - - _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, id) + _gitHubClient.Repository.Release.Delete(OWNER, REPOSITORY, RELEASE_ID) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, id)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.DeleteReleaseAsync(OWNER, REPOSITORY, _release)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBeSameAs(_exception); } @@ -688,7 +688,7 @@ public async Task Should_Publish_Release() _gitHubClient.Repository.Release.Edit(OWNER, REPOSITORY, RELEASE_ID, Arg.Any()) .Returns(Task.FromResult(new Octokit.Release())); - await _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, RELEASE_ID).ConfigureAwait(false); + await _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, _release).ConfigureAwait(false); await _gitHubClient.Repository.Release.Received(1).Edit(OWNER, REPOSITORY, RELEASE_ID, Arg.Is(o => o.Draft == false && @@ -701,7 +701,7 @@ public async Task Should_Throw_An_Exception_On_Publishing_Release_For_Non_Existe _gitHubClient.Repository.Release.Edit(OWNER, REPOSITORY, RELEASE_ID, Arg.Any()) .Returns(Task.FromException(_notFoundException)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, RELEASE_ID)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, _release)).ConfigureAwait(false); ex.Message.ShouldBe(_notFoundException.Message); ex.InnerException.ShouldBe(_notFoundException); } @@ -712,7 +712,7 @@ public async Task Should_Throw_An_Exception_On_Publishing_Release() _gitHubClient.Repository.Release.Edit(OWNER, REPOSITORY, RELEASE_ID, Arg.Any()) .Returns(Task.FromException(_exception)); - var ex = await Should.ThrowAsync(() => _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, RELEASE_ID)).ConfigureAwait(false); + var ex = await Should.ThrowAsync(() => _gitHubProvider.PublishReleaseAsync(OWNER, REPOSITORY, TAG_NAME, _release)).ConfigureAwait(false); ex.Message.ShouldBe(_exception.Message); ex.InnerException.ShouldBe(_exception); } diff --git a/src/GitReleaseManager.Core.Tests/VcsServiceTests.cs b/src/GitReleaseManager.Core.Tests/VcsServiceTests.cs index 8b3ebe96..86306af7 100644 --- a/src/GitReleaseManager.Core.Tests/VcsServiceTests.cs +++ b/src/GitReleaseManager.Core.Tests/VcsServiceTests.cs @@ -26,7 +26,8 @@ public class VcsServiceTests { private const string OWNER = "owner"; private const string REPOSITORY = "repository"; - private const int MILESTONE_NUMBER = 1; + private const int MILESTONE_PUBLIC_NUMBER = 1; + private const int MILESTONE_INTERNAL_NUMBER = 123; private const string MILESTONE_TITLE = "0.1.0"; private const string TAG_NAME = "0.1.0"; private const string RELEASE_NOTES = "Release Notes"; @@ -126,7 +127,7 @@ public async Task Should_Add_Assets() await _vcsService.AddAssetsAsync(OWNER, REPOSITORY, TAG_NAME, _assets).ConfigureAwait(false); await _vcsProvider.Received(1).GetReleaseAsync(OWNER, REPOSITORY, TAG_NAME).ConfigureAwait(false); - await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); + await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); await _vcsProvider.Received(assetsCount).UploadAssetAsync(release, Arg.Any()).ConfigureAwait(false); _logger.DidNotReceive().Warning(Arg.Any(), Arg.Any()); @@ -149,7 +150,7 @@ public async Task Should_Add_Assets_With_Deleting_Existing_Assets() await _vcsService.AddAssetsAsync(OWNER, REPOSITORY, TAG_NAME, _assets).ConfigureAwait(false); await _vcsProvider.Received(1).GetReleaseAsync(OWNER, REPOSITORY, TAG_NAME).ConfigureAwait(false); - await _vcsProvider.Received(releaseAssetsCount).DeleteAssetAsync(OWNER, REPOSITORY, releaseAsset.Id).ConfigureAwait(false); + await _vcsProvider.Received(releaseAssetsCount).DeleteAssetAsync(OWNER, REPOSITORY, releaseAsset).ConfigureAwait(false); await _vcsProvider.Received(assetsCount).UploadAssetAsync(release, Arg.Any()).ConfigureAwait(false); _logger.Received(releaseAssetsCount).Warning(Arg.Any(), Arg.Any()); @@ -172,7 +173,7 @@ public async Task Should_Throw_Exception_On_Adding_Assets_When_Asset_File_Not_Ex ex.Message.ShouldContain(assetFilePath); await _vcsProvider.Received(1).GetReleaseAsync(OWNER, REPOSITORY, TAG_NAME).ConfigureAwait(false); - await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); + await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); await _vcsProvider.DidNotReceive().UploadAssetAsync(release, Arg.Any()).ConfigureAwait(false); } @@ -182,7 +183,7 @@ public async Task Should_Do_Nothing_On_Missing_Assets(IList assets) await _vcsService.AddAssetsAsync(OWNER, REPOSITORY, TAG_NAME, assets).ConfigureAwait(false); await _vcsProvider.DidNotReceive().GetReleaseAsync(OWNER, REPOSITORY, TAG_NAME).ConfigureAwait(false); - await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); + await _vcsProvider.DidNotReceive().DeleteAssetAsync(OWNER, REPOSITORY, Arg.Any()).ConfigureAwait(false); await _vcsProvider.DidNotReceive().UploadAssetAsync(Arg.Any(), Arg.Any()).ConfigureAwait(false); } @@ -205,7 +206,7 @@ public async Task Should_Create_Labels() _vcsProvider.GetLabelsAsync(OWNER, REPOSITORY) .Returns(Task.FromResult((IEnumerable