From 37db993eead937ca06bd79f250f6d64cacd6c465 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:21:42 +0200 Subject: [PATCH 01/17] Remove unused directives --- .../ActionMappers/ActionBrowserV1Mapper.cs | 1 - .../ActionMappers/ActionCommandV1Mapper.cs | 1 - .../ActionMappers/ActionExecutableV1Mapper.cs | 1 - .../ActionMappers/ActionGitFetchV1Mapper.cs | 1 - .../ActionMappers/ActionJustTextV1Mapper.cs | 1 - .../ActionProvider/ActionClipboardCopyV1Mapper.cs | 1 - src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs | 1 - .../DefaultAppSettingsTests/DocsAppSettingsTests.cs | 1 - 8 files changed, 8 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs index ebc22001..2b273d04 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using System.Linq; using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs index d64ce081..31f3e897 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using System.Linq; using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs index bbce34b8..4fa101d8 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs @@ -3,7 +3,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; using System.IO.Abstractions; -using System.Linq; using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitFetchV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitFetchV1Mapper.cs index 040c78d2..dfa1cf3a 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitFetchV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitFetchV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using System.Linq; using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs index 62e1aacc..2702b3a7 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using System.Linq; using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; diff --git a/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs b/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs index 76b1cb66..70f2f078 100644 --- a/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs +++ b/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Plugin.Clipboard.ActionProvider; using System; using System.Collections.Generic; -using System.Linq; using JetBrains.Annotations; using RepoM.Api.Common; using RepoM.Api.Git; diff --git a/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs b/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs index d65e4d63..bd1765f4 100644 --- a/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs +++ b/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Plugin.SonarCloud; using System; using System.Collections.Generic; -using System.Linq; using JetBrains.Annotations; using RepoM.Api.Common; using RepoM.Api.Git; diff --git a/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs b/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs index d9b2d154..160d2298 100644 --- a/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs +++ b/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs @@ -1,6 +1,5 @@ namespace RepoM.Plugin.Misc.Tests.DefaultAppSettingsTests; -using System; using System.IO.Abstractions.TestingHelpers; using System.Text; using System.Threading.Tasks; From dcde901086c0238bdb8c087f7c6f42f850e94bfb Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:35:07 +0200 Subject: [PATCH 02/17] Remome junk in NameHelper, Fixed ActionClipboardCopy --- src/RepoM.Api/IO/NameHelper.cs | 32 +------------------ .../IRepositoryExpressionEvaluator.cs | 13 ++++++++ .../ActionClipboardCopyV1Mapper.cs | 16 ++-------- .../ActionClipboardCopyV1MapperTests.cs | 9 ++---- 4 files changed, 19 insertions(+), 51 deletions(-) diff --git a/src/RepoM.Api/IO/NameHelper.cs b/src/RepoM.Api/IO/NameHelper.cs index eb1d53d7..4e87a258 100644 --- a/src/RepoM.Api/IO/NameHelper.cs +++ b/src/RepoM.Api/IO/NameHelper.cs @@ -6,38 +6,8 @@ namespace RepoM.Api.IO; public static class NameHelper { - // todo public static string EvaluateName(in string? input, in Repository repository, ITranslationService translationService, IRepositoryExpressionEvaluator repositoryExpressionEvaluator) { - return repositoryExpressionEvaluator.EvaluateStringExpression( - ReplaceTranslatables( - translationService.Translate(input ?? string.Empty), - translationService), - repository); - } - - private static string ReplaceTranslatables(string? value, ITranslationService translationService) - { - if (value is null) - { - return string.Empty; - } - - value = ReplaceTranslatable(value, "Open", translationService); - value = ReplaceTranslatable(value, "OpenIn", translationService); - value = ReplaceTranslatable(value, "OpenWith", translationService); - - return value; - } - - private static string ReplaceTranslatable(string value, string translatable, ITranslationService translationService) - { - if (!value.StartsWith("{" + translatable + "}")) - { - return value; - } - - var rest = value.Replace("{" + translatable + "}", "").Trim(); - return translationService.Translate("(" + translatable + ")", rest); // XMl doesn't support {} + return input == null ? string.Empty : repositoryExpressionEvaluator.EvaluateStringExpression(input, repository); } } \ No newline at end of file diff --git a/src/RepoM.Core.Plugin/Expressions/IRepositoryExpressionEvaluator.cs b/src/RepoM.Core.Plugin/Expressions/IRepositoryExpressionEvaluator.cs index 44ff0d83..3a239938 100644 --- a/src/RepoM.Core.Plugin/Expressions/IRepositoryExpressionEvaluator.cs +++ b/src/RepoM.Core.Plugin/Expressions/IRepositoryExpressionEvaluator.cs @@ -9,4 +9,17 @@ public interface IRepositoryExpressionEvaluator object? EvaluateValueExpression(string value, IRepository? repository); bool EvaluateBooleanExpression(string? value, IRepository? repository); +} + +public static class RepositoryExpressionEvaluatorExtensions +{ + public static string EvaluateNullStringExpression(this IRepositoryExpressionEvaluator evaluator, string? value, IRepository? repository) + { + if (string.IsNullOrEmpty(value)) + { + return string.Empty; + } + + return evaluator.EvaluateStringExpression(value, repository); + } } \ No newline at end of file diff --git a/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs b/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs index 70f2f078..04ad9a19 100644 --- a/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs +++ b/src/RepoM.Plugin.Clipboard/ActionProvider/ActionClipboardCopyV1Mapper.cs @@ -3,9 +3,7 @@ namespace RepoM.Plugin.Clipboard.ActionProvider; using System; using System.Collections.Generic; using JetBrains.Annotations; -using RepoM.Api.Common; using RepoM.Api.Git; -using RepoM.Api.IO; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using RepoM.Core.Plugin.Expressions; @@ -16,14 +14,10 @@ namespace RepoM.Plugin.Clipboard.ActionProvider; internal class ActionClipboardCopyV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionClipboardCopyV1Mapper( - IRepositoryExpressionEvaluator expressionEvaluator, - ITranslationService translationService) + public ActionClipboardCopyV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } public bool CanMap(RepositoryAction action) @@ -48,12 +42,8 @@ private IEnumerable Map(RepositoryActionClipboardCopyV1? a yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); - var txt = string.Empty; - if (!string.IsNullOrWhiteSpace(action.Text)) - { - txt = _expressionEvaluator.EvaluateStringExpression(action.Text, repository); - } + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); + var txt = _expressionEvaluator.EvaluateNullStringExpression(action.Text, repository); yield return new Api.Git.RepositoryAction(name, repository) { diff --git a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs index 10ca468f..72dabfc3 100644 --- a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs +++ b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs @@ -36,9 +36,7 @@ public ActionClipboardCopyV1MapperTests() IRepositoryExpressionEvaluator expressionEvaluator = A.Fake(); ITranslationService translationService = A.Fake(); - _sut = new ActionClipboardCopyV1Mapper( - expressionEvaluator, - translationService); + _sut = new ActionClipboardCopyV1Mapper(expressionEvaluator); _action = new RepositoryActionClipboardCopyV1 { @@ -66,14 +64,11 @@ public ActionClipboardCopyV1MapperTests() public void Ctor_ShouldThrowArgumentNullException_WhenAnArgumentIsNull() { // arrange - IRepositoryExpressionEvaluator expressionEvaluator = A.Dummy(); - ITranslationService translationService = A.Dummy(); // act var actions = new List { - () => _ = new ActionClipboardCopyV1Mapper(expressionEvaluator, null!), - () => _ = new ActionClipboardCopyV1Mapper(null!, translationService), + () => _ = new ActionClipboardCopyV1Mapper(null!), }; // assert From 061c4a7254b6dd3914e81aa05feed85808d961de Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:39:41 +0200 Subject: [PATCH 03/17] fix tests --- ...pyV1MapperTests.Map_ShouldMap_WhenNameSet_empty.verified.txt | 2 +- ...opyV1MapperTests.Map_ShouldMap_WhenNameSet_null.verified.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_empty.verified.txt b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_empty.verified.txt index e5ced40c..6f6f0135 100644 --- a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_empty.verified.txt +++ b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_empty.verified.txt @@ -1,7 +1,7 @@ [ { $type: RepositoryAction, - Name: ES_, + Name: , Action: { $type: CopyToClipboardAction, Text: ES_text123 diff --git a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_null.verified.txt b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_null.verified.txt index e5ced40c..6f6f0135 100644 --- a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_null.verified.txt +++ b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/Verified/ActionClipboardCopyV1MapperTests.Map_ShouldMap_WhenNameSet_null.verified.txt @@ -1,7 +1,7 @@ [ { $type: RepositoryAction, - Name: ES_, + Name: , Action: { $type: CopyToClipboardAction, Text: ES_text123 From 81ef904de62e13b242970436c7261bc04eb17544 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:44:03 +0200 Subject: [PATCH 04/17] Update ActionHeidiDatabase --- .../ActionHeidiDatabasesV1Mapper.cs | 14 ++------------ .../ActionHeidiDatabasesV1MapperTests.cs | 15 ++++----------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/RepoM.Plugin.Heidi/ActionProvider/ActionHeidiDatabasesV1Mapper.cs b/src/RepoM.Plugin.Heidi/ActionProvider/ActionHeidiDatabasesV1Mapper.cs index b1acff0d..91f2b44a 100644 --- a/src/RepoM.Plugin.Heidi/ActionProvider/ActionHeidiDatabasesV1Mapper.cs +++ b/src/RepoM.Plugin.Heidi/ActionProvider/ActionHeidiDatabasesV1Mapper.cs @@ -5,9 +5,7 @@ namespace RepoM.Plugin.Heidi.ActionProvider; using System.Linq; using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using RepoM.Api.Common; using RepoM.Api.Git; -using RepoM.Api.IO; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using RepoM.Core.Plugin.Expressions; @@ -22,20 +20,17 @@ internal class ActionHeidiDatabasesV1Mapper : IActionToRepositoryActionMapper { private readonly IHeidiConfigurationService _service; private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; private readonly IHeidiSettings _settings; private readonly ILogger _logger; public ActionHeidiDatabasesV1Mapper( IHeidiConfigurationService service, IRepositoryExpressionEvaluator expressionEvaluator, - ITranslationService translationService, IHeidiSettings settings, ILogger logger) { _service = service ?? throw new ArgumentNullException(nameof(service)); _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } @@ -50,7 +45,7 @@ public IEnumerable Map(RepositoryAction action, Repository return Map(action as RepositoryActionHeidiDatabasesV1, repository); } - private IEnumerable Map(RepositoryActionHeidiDatabasesV1? action, Repository repository) + private IEnumerable Map(RepositoryActionHeidiDatabasesV1? action, IRepository repository) { if (action == null) { @@ -71,12 +66,7 @@ private IEnumerable Map(RepositoryActionHeidiDatabasesV1? RepositoryHeidiConfiguration[] databases = GetHeidiDatabases(action, repository); - string? name = action.Name; - - if (!string.IsNullOrWhiteSpace(name)) - { - name = NameHelper.EvaluateName(name, repository, _translationService, _expressionEvaluator); - } + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); if (!string.IsNullOrWhiteSpace(name)) { diff --git a/tests/RepoM.Plugin.Heidi.Tests/ActionProvider/ActionHeidiDatabasesV1MapperTests.cs b/tests/RepoM.Plugin.Heidi.Tests/ActionProvider/ActionHeidiDatabasesV1MapperTests.cs index 908f21dc..31758bae 100644 --- a/tests/RepoM.Plugin.Heidi.Tests/ActionProvider/ActionHeidiDatabasesV1MapperTests.cs +++ b/tests/RepoM.Plugin.Heidi.Tests/ActionProvider/ActionHeidiDatabasesV1MapperTests.cs @@ -8,7 +8,6 @@ namespace RepoM.Plugin.Heidi.Tests.ActionProvider; using FluentAssertions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using RepoM.Api.Common; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using RepoM.Core.Plugin.Expressions; @@ -44,12 +43,10 @@ public ActionHeidiDatabasesV1MapperTests() _service = A.Fake(); _expressionEvaluator = A.Fake(); _settings = A.Fake(); - ITranslationService translationService = A.Fake(); _sut = new ActionHeidiDatabasesV1Mapper( _service, _expressionEvaluator, - translationService, _settings, NullLogger.Instance); @@ -74,8 +71,6 @@ public ActionHeidiDatabasesV1MapperTests() }); A.CallTo(() => _service.GetByKey(A._)).Returns(Array.Empty()); A.CallTo(() => _service.GetByRepository(_repository)).Returns(Array.Empty()); - A.CallTo(() => translationService.Translate(A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "unexpected by test."); - A.CallTo(() => translationService.Translate(A._, A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "unexpected by test."); } [Fact] @@ -84,18 +79,16 @@ public void Ctor_ShouldThrowArgumentNullException_WhenAnArgumentIsNull() // arrange IHeidiConfigurationService service = A.Dummy(); IRepositoryExpressionEvaluator expressionEvaluator = A.Dummy(); - ITranslationService translationService = A.Dummy(); IHeidiSettings settings = A.Dummy(); ILogger logger = A.Dummy(); // act var actions = new List { - () => _ = new ActionHeidiDatabasesV1Mapper(service, expressionEvaluator, translationService, settings, null!), - () => _ = new ActionHeidiDatabasesV1Mapper(service, expressionEvaluator, translationService, null!, logger), - () => _ = new ActionHeidiDatabasesV1Mapper(service, expressionEvaluator, null!, settings, logger), - () => _ = new ActionHeidiDatabasesV1Mapper(service, null!, translationService, settings, logger), - () => _ = new ActionHeidiDatabasesV1Mapper(null!, expressionEvaluator, translationService, settings, logger), + () => _ = new ActionHeidiDatabasesV1Mapper(service, expressionEvaluator, settings, null!), + () => _ = new ActionHeidiDatabasesV1Mapper(service, expressionEvaluator, null!, logger), + () => _ = new ActionHeidiDatabasesV1Mapper(service, null!, settings, logger), + () => _ = new ActionHeidiDatabasesV1Mapper(null!, expressionEvaluator, settings, logger), }; // assert From edd4c7d615689bb3848d1c7f8a81dd0d10b21b6e Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:47:18 +0200 Subject: [PATCH 05/17] Fix SonarCloudV1 --- .../ActionSonarCloudV1Mapper.cs | 8 ++------ .../ActionSonarCloudV1MapperTests.cs | 12 +++--------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs b/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs index bd1765f4..67cb39d4 100644 --- a/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs +++ b/src/RepoM.Plugin.SonarCloud/ActionSonarCloudV1Mapper.cs @@ -3,9 +3,7 @@ namespace RepoM.Plugin.SonarCloud; using System; using System.Collections.Generic; using JetBrains.Annotations; -using RepoM.Api.Common; using RepoM.Api.Git; -using RepoM.Api.IO; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using RepoM.Core.Plugin.Expressions; @@ -17,13 +15,11 @@ internal class ActionSonarCloudV1Mapper : IActionToRepositoryActionMapper { private readonly ISonarCloudFavoriteService _service; private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionSonarCloudV1Mapper(ISonarCloudFavoriteService service, IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionSonarCloudV1Mapper(ISonarCloudFavoriteService service, IRepositoryExpressionEvaluator expressionEvaluator) { _service = service ?? throw new ArgumentNullException(nameof(service)); _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(RepositoryAction action) @@ -53,7 +49,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); var key = _expressionEvaluator.EvaluateStringExpression(action.Project!, repository); if (_service.IsInitialized) diff --git a/tests/RepoM.Plugin.SonarCloud.Tests/ActionSonarCloudV1MapperTests.cs b/tests/RepoM.Plugin.SonarCloud.Tests/ActionSonarCloudV1MapperTests.cs index 0f962656..ddc6e8c6 100644 --- a/tests/RepoM.Plugin.SonarCloud.Tests/ActionSonarCloudV1MapperTests.cs +++ b/tests/RepoM.Plugin.SonarCloud.Tests/ActionSonarCloudV1MapperTests.cs @@ -3,7 +3,6 @@ namespace RepoM.Plugin.SonarCloud.Tests; using System; using FakeItEasy; using FluentAssertions; -using RepoM.Api.Common; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data; using Xunit; using RepoM.Core.Plugin.Expressions; @@ -13,15 +12,13 @@ public class ActionSonarCloudV1MapperTests { private readonly ISonarCloudFavoriteService _service; private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; private readonly ActionSonarCloudV1Mapper _sut; public ActionSonarCloudV1MapperTests() { _service = A.Fake(); _expressionEvaluator = A.Fake(); - _translationService = A.Fake(); - _sut = new ActionSonarCloudV1Mapper(_service, _expressionEvaluator, _translationService); + _sut = new ActionSonarCloudV1Mapper(_service, _expressionEvaluator); } [Fact] @@ -30,17 +27,14 @@ public void Ctor_ShouldThrow_WhenArgumentNull() // arrange ISonarCloudFavoriteService service = A.Fake(); IRepositoryExpressionEvaluator expressionEvaluator = A.Fake(); - ITranslationService translationService = A.Fake(); // act - Func act1 = () => new ActionSonarCloudV1Mapper(service, expressionEvaluator, null!); - Func act2 = () => new ActionSonarCloudV1Mapper(service, null!, translationService); - Func act3 = () => new ActionSonarCloudV1Mapper(null!, expressionEvaluator, translationService); + Func act1 = () => new ActionSonarCloudV1Mapper(service, null!); + Func act2 = () => new ActionSonarCloudV1Mapper(null!, expressionEvaluator); // assert act1.Should().Throw(); act2.Should().Throw(); - act3.Should().Throw(); } [Fact] From 7a77350056024d9a41add48f721e103577015473 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:50:48 +0200 Subject: [PATCH 06/17] Action associate file --- .../ActionAssociateFileV1Mapper.cs | 9 ++--- .../ActionMapperCompositionFactory.cs | 2 +- .../ActionAssociateFileV1MapperTests.cs | 33 ++++++------------- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1Mapper.cs index c9e0d2a1..195d80ec 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1Mapper.cs @@ -4,7 +4,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System.Collections.Generic; using System.IO; using System.Linq; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; @@ -15,12 +14,10 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; public class ActionAssociateFileV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionAssociateFileV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionAssociateFileV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(RepositoryAction action) @@ -50,8 +47,8 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); - + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); + Git.RepositoryAction? menuItem = CreateFileAssociationSubMenu( repository, name, diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index 761f8338..48d320fd 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -30,7 +30,7 @@ public static ActionMapperComposition Create( new ActionGitPushV1Mapper(expressionEvaluator, translationService, repositoryWriter), new ActionIgnoreRepositoriesV1Mapper(expressionEvaluator, translationService, repositoryMonitor), new ActionSeparatorV1Mapper(expressionEvaluator), - new ActionAssociateFileV1Mapper(expressionEvaluator, translationService), + new ActionAssociateFileV1Mapper(expressionEvaluator), new ActionJustTextV1Mapper(expressionEvaluator, translationService), }; diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1MapperTests.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1MapperTests.cs index a6716f7b..b103b483 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1MapperTests.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionAssociateFileV1MapperTests.cs @@ -4,7 +4,6 @@ namespace RepoM.Api.Tests.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System.Linq; using FakeItEasy; using FluentAssertions; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; @@ -15,18 +14,8 @@ namespace RepoM.Api.Tests.IO.ModuleBasedRepositoryActionProvider.ActionMappers; public class ActionAssociateFileV1MapperTests { - private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - private Repository _repository; - - public ActionAssociateFileV1MapperTests() - { - _repository = new Repository(""); - _expressionEvaluator = A.Fake(); - _translationService = A.Fake(); - A.CallTo(() => _translationService.Translate(A._, A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "dummy"); - A.CallTo(() => _translationService.Translate(A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "dummy"); - } + private readonly IRepositoryExpressionEvaluator _expressionEvaluator = A.Fake(); + private readonly Repository _repository = new(""); [Fact] public void Ctor_ShouldThrown_WhenArgumentIsNull() @@ -34,19 +23,17 @@ public void Ctor_ShouldThrown_WhenArgumentIsNull() // arrange // act - Action act1 = () => _ = new ActionAssociateFileV1Mapper(_expressionEvaluator, null!); - Action act2 = () => _ = new ActionAssociateFileV1Mapper(null!, _translationService); + Action act = () => _ = new ActionAssociateFileV1Mapper(null!); // assert - act1.Should().ThrowExactly(); - act2.Should().ThrowExactly(); + act.Should().ThrowExactly(); } [Fact] public void CanMap_ShouldReturnFalse_WhenInputNull() { // arrange - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act var result = sut.CanMap(null!); @@ -60,7 +47,7 @@ public void CanMap_ShouldReturnFalse_WhenInputIsNotCorrectType() { // arrange - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act var result = sut.CanMap(new DummyRepositoryAction()); @@ -73,7 +60,7 @@ public void CanMap_ShouldReturnFalse_WhenInputIsNotCorrectType() public void CanMap_ShouldReturnTrue_WhenInputIsOfTypeRepositoryActionAssociateFileV1() { // arrange - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act var result = sut.CanMap(new RepositoryActionAssociateFileV1()); @@ -87,7 +74,7 @@ public void Map_ShouldReturnEmpty_WhenActionIsNotOfCorrectType() { // arrange var action = new DummyRepositoryAction(); - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act RepositoryActionBase[] result = sut.Map(action, _repository, ActionMapperCompositionFactory.CreateSmall(_expressionEvaluator, A.Dummy())).ToArray(); @@ -105,7 +92,7 @@ public void Map_ShouldReturnEmpty_WhenActionActiveIsEvaluatesToFalse() Active = "dummy active string", }; A.CallTo(() => _expressionEvaluator.EvaluateBooleanExpression(action.Active, _repository)).Returns(false); - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act RepositoryActionBase[] result = sut.Map(action, _repository, ActionMapperCompositionFactory.CreateSmall(_expressionEvaluator, A.Dummy())).ToArray(); @@ -123,7 +110,7 @@ public void Map_ShouldReturnEmpty_WhenActionExtensionIsNull() Extension = null, }; A.CallTo(() => _expressionEvaluator.EvaluateBooleanExpression(A._, _repository)).Returns(true); - var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator, _translationService) as IActionToRepositoryActionMapper; + var sut = new ActionAssociateFileV1Mapper(_expressionEvaluator) as IActionToRepositoryActionMapper; // act RepositoryActionBase[] result = sut.Map(action, _repository, ActionMapperCompositionFactory.CreateSmall(_expressionEvaluator, A.Dummy())).ToArray(); From 5bf8863d8b28166ef5bd5a4611244667ab31065c Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:53:44 +0200 Subject: [PATCH 07/17] Action Browse --- .../ActionMappers/ActionBrowserV1Mapper.cs | 7 ++----- .../ActionMapperCompositionFactory.cs | 2 +- ...urationTest.Create_ShouldProcessSeparator1.verified.txt | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs index 2b273d04..ba01900f 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowserV1Mapper.cs @@ -2,7 +2,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; @@ -12,12 +11,10 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; public class ActionBrowserV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionBrowserV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionBrowserV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(Data.RepositoryAction action) @@ -47,7 +44,7 @@ private IEnumerable Map(RepositoryActionBrowserV1? action, Rep yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); var url = _expressionEvaluator.EvaluateStringExpression(action.Url, repository); yield return new RepositoryAction(name, repository) { diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index 48d320fd..6a502950 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -19,7 +19,7 @@ public static ActionMapperComposition Create( var mappers = new IActionToRepositoryActionMapper[] { new ActionBrowseRepositoryV1Mapper(expressionEvaluator, translationService), - new ActionBrowserV1Mapper(expressionEvaluator, translationService), + new ActionBrowserV1Mapper(expressionEvaluator), new ActionCommandV1Mapper(expressionEvaluator, translationService), new ActionExecutableV1Mapper(expressionEvaluator,translationService, fileSystem), new ActionFolderV1Mapper(expressionEvaluator, translationService), diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/Verified/RepositorySpecificConfigurationTest.Create_ShouldProcessSeparator1.verified.txt b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/Verified/RepositorySpecificConfigurationTest.Create_ShouldProcessSeparator1.verified.txt index ad4f6223..1fe689a1 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/Verified/RepositorySpecificConfigurationTest.Create_ShouldProcessSeparator1.verified.txt +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/Verified/RepositorySpecificConfigurationTest.Create_ShouldProcessSeparator1.verified.txt @@ -6,7 +6,7 @@ $type: DelegateAction, Action: { Type: Action, - Target: ActionBrowserV1Mapper.<>c__DisplayClass5_0, + Target: ActionBrowserV1Mapper.<>c__DisplayClass4_0, Method: Void Map(System.Object, System.Object) } }, @@ -28,7 +28,7 @@ $type: DelegateAction, Action: { Type: Action, - Target: ActionBrowserV1Mapper.<>c__DisplayClass5_0, + Target: ActionBrowserV1Mapper.<>c__DisplayClass4_0, Method: Void Map(System.Object, System.Object) } }, From ac1257fdf6739c768e34af27387483f2200ca43b Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:56:34 +0200 Subject: [PATCH 08/17] ActionCommandV1 --- .../ActionMappers/ActionCommandV1Mapper.cs | 14 ++++++-------- .../ActionMapperCompositionFactory.cs | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs index 31f3e897..03665603 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionCommandV1Mapper.cs @@ -2,22 +2,20 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; +using RepoM.Core.Plugin.Repository; using RepoM.Core.Plugin.RepositoryActions.Actions; using RepositoryAction = RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.RepositoryAction; public class ActionCommandV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionCommandV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionCommandV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(RepositoryAction action) @@ -30,7 +28,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository return Map(action as RepositoryActionCommandV1, repository); } - private IEnumerable Map(RepositoryActionCommandV1? action, Repository repository) + private IEnumerable Map(RepositoryActionCommandV1? action, IRepository repository) { if (action == null) { @@ -42,9 +40,9 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); - var command = _expressionEvaluator.EvaluateStringExpression(action.Command ?? string.Empty, repository); - var arguments = _expressionEvaluator.EvaluateStringExpression(action.Arguments ?? string.Empty, repository); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); + var command = _expressionEvaluator.EvaluateNullStringExpression(action.Command, repository); + var arguments = _expressionEvaluator.EvaluateNullStringExpression(action.Arguments, repository); yield return new Git.RepositoryAction(name, repository) { diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index 6a502950..456972fa 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -20,7 +20,7 @@ public static ActionMapperComposition Create( { new ActionBrowseRepositoryV1Mapper(expressionEvaluator, translationService), new ActionBrowserV1Mapper(expressionEvaluator), - new ActionCommandV1Mapper(expressionEvaluator, translationService), + new ActionCommandV1Mapper(expressionEvaluator), new ActionExecutableV1Mapper(expressionEvaluator,translationService, fileSystem), new ActionFolderV1Mapper(expressionEvaluator, translationService), new ActionForEachV1Mapper(expressionEvaluator), From b3d3f0ed134bccdaef5c2d76b173d53e6b5c8ae1 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:58:03 +0200 Subject: [PATCH 09/17] Action Executable --- .../ActionMappers/ActionExecutableV1Mapper.cs | 10 ++++------ .../ActionMapperCompositionFactory.cs | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs index 4fa101d8..899f42fa 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionExecutableV1Mapper.cs @@ -3,23 +3,21 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; using System.IO.Abstractions; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; +using RepoM.Core.Plugin.Repository; using RepoM.Core.Plugin.RepositoryActions.Actions; using RepositoryAction = Data.RepositoryAction; public class ActionExecutableV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; private readonly IFileSystem _fileSystem; - public ActionExecutableV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService, IFileSystem fileSystem) + public ActionExecutableV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, IFileSystem fileSystem) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); } @@ -33,7 +31,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository return Map(action as RepositoryActionExecutableV1, repository); } - private IEnumerable Map(RepositoryActionExecutableV1? action, Repository repository) + private IEnumerable Map(RepositoryActionExecutableV1? action, IRepository repository) { if (action == null) { @@ -45,7 +43,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); var found = false; foreach (var executable in action.Executables) diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index 456972fa..51b2183d 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -21,7 +21,7 @@ public static ActionMapperComposition Create( new ActionBrowseRepositoryV1Mapper(expressionEvaluator, translationService), new ActionBrowserV1Mapper(expressionEvaluator), new ActionCommandV1Mapper(expressionEvaluator), - new ActionExecutableV1Mapper(expressionEvaluator,translationService, fileSystem), + new ActionExecutableV1Mapper(expressionEvaluator, fileSystem), new ActionFolderV1Mapper(expressionEvaluator, translationService), new ActionForEachV1Mapper(expressionEvaluator), new ActionGitCheckoutV1Mapper(expressionEvaluator, translationService, repositoryWriter), From 461bea2a93fc12fd0426e6c098a040bdf4ff2829 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:59:32 +0200 Subject: [PATCH 10/17] ActionFolderV1 --- .../ActionMappers/ActionFolderV1Mapper.cs | 7 ++----- .../ActionMapperCompositionFactory.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionFolderV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionFolderV1Mapper.cs index 2b0929ca..2bdbb561 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionFolderV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionFolderV1Mapper.cs @@ -3,7 +3,6 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; using System.Linq; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; @@ -12,12 +11,10 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; public class ActionFolderV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionFolderV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionFolderV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(RepositoryAction action) @@ -48,7 +45,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository deferred = _expressionEvaluator.EvaluateBooleanExpression(action.IsDeferred, repository); } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); if (deferred) { diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index 51b2183d..f43f51c4 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -22,7 +22,7 @@ public static ActionMapperComposition Create( new ActionBrowserV1Mapper(expressionEvaluator), new ActionCommandV1Mapper(expressionEvaluator), new ActionExecutableV1Mapper(expressionEvaluator, fileSystem), - new ActionFolderV1Mapper(expressionEvaluator, translationService), + new ActionFolderV1Mapper(expressionEvaluator), new ActionForEachV1Mapper(expressionEvaluator), new ActionGitCheckoutV1Mapper(expressionEvaluator, translationService, repositoryWriter), new ActionGitFetchV1Mapper(expressionEvaluator, translationService, repositoryWriter), From 5b0cde4902cc573e080cf21419dc19474eaa3230 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 09:59:37 +0200 Subject: [PATCH 11/17] ActionGitCheckoutV1Mapper --- .../ActionMappers/ActionGitCheckoutV1Mapper.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitCheckoutV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitCheckoutV1Mapper.cs index c62c226a..34cf2da1 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitCheckoutV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionGitCheckoutV1Mapper.cs @@ -45,11 +45,7 @@ private IEnumerable Map(RepositoryActionGitCheckoutV1? act yield break; } - var name = action.Name; - if (!string.IsNullOrEmpty(name)) - { - name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); - } + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); if (string.IsNullOrWhiteSpace(name)) { From 986775e5621f5119ef2f3c2759c3801fd594658f Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:04:38 +0200 Subject: [PATCH 12/17] ActionJustTextV1 --- .../ActionMappers/ActionJustTextV1Mapper.cs | 10 ++++------ .../ActionMapperCompositionFactory.cs | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs index 2702b3a7..7f973b91 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionJustTextV1Mapper.cs @@ -2,22 +2,20 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using RepoM.Api.Common; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; +using RepoM.Core.Plugin.Repository; using RepoM.Core.Plugin.RepositoryActions.Actions; using RepositoryAction = RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.RepositoryAction; public class ActionJustTextV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; - public ActionJustTextV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator, ITranslationService translationService) + public ActionJustTextV1Mapper(IRepositoryExpressionEvaluator expressionEvaluator) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); } bool IActionToRepositoryActionMapper.CanMap(RepositoryAction action) @@ -30,7 +28,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository return Map(action as RepositoryActionJustTextV1, repository); } - private IEnumerable Map(RepositoryActionJustTextV1? action, Repository repository) + private IEnumerable Map(RepositoryActionJustTextV1? action, IRepository repository) { if (action == null) { @@ -42,7 +40,7 @@ IEnumerable IActionToRepositoryActionMapper.Map(Repository yield break; } - var name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); yield return new Git.RepositoryAction(name, repository) { diff --git a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs index f43f51c4..cb172580 100644 --- a/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs +++ b/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/ActionMapperCompositionFactory.cs @@ -31,7 +31,7 @@ public static ActionMapperComposition Create( new ActionIgnoreRepositoriesV1Mapper(expressionEvaluator, translationService, repositoryMonitor), new ActionSeparatorV1Mapper(expressionEvaluator), new ActionAssociateFileV1Mapper(expressionEvaluator), - new ActionJustTextV1Mapper(expressionEvaluator, translationService), + new ActionJustTextV1Mapper(expressionEvaluator), }; return new ActionMapperComposition(mappers, expressionEvaluator); @@ -39,10 +39,6 @@ public static ActionMapperComposition Create( public static ActionMapperComposition CreateSmall(IRepositoryExpressionEvaluator expressionEvaluator, IActionToRepositoryActionMapper actionToRepositoryActionMapper) { - var list = new[] - { - actionToRepositoryActionMapper, - }; - return new ActionMapperComposition(list, expressionEvaluator); + return new ActionMapperComposition(new[] { actionToRepositoryActionMapper, }, expressionEvaluator); } } \ No newline at end of file From 12be1473b07067d12eaaf61a9e609ad00226b800 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:06:21 +0200 Subject: [PATCH 13/17] ActionPinRepositoryV1 --- .../ActionPinRepositoryV1Mapper.cs | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionPinRepositoryV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionPinRepositoryV1Mapper.cs index 3645009e..ab53aa56 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionPinRepositoryV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionPinRepositoryV1Mapper.cs @@ -2,26 +2,24 @@ namespace RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using System; using System.Collections.Generic; -using RepoM.Api.Common; +using JetBrains.Annotations; using RepoM.Api.Git; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.Actions; using RepoM.Core.Plugin.Expressions; using RepoM.Core.Plugin.RepositoryActions.Actions; using RepositoryAction = RepoM.Api.IO.ModuleBasedRepositoryActionProvider.Data.RepositoryAction; +[UsedImplicitly] public class ActionPinRepositoryV1Mapper : IActionToRepositoryActionMapper { private readonly IRepositoryExpressionEvaluator _expressionEvaluator; - private readonly ITranslationService _translationService; private readonly IRepositoryMonitor _repositoryMonitor; public ActionPinRepositoryV1Mapper( IRepositoryExpressionEvaluator expressionEvaluator, - ITranslationService translationService, IRepositoryMonitor repositoryMonitor) { _expressionEvaluator = expressionEvaluator ?? throw new ArgumentNullException(nameof(expressionEvaluator)); - _translationService = translationService ?? throw new ArgumentNullException(nameof(translationService)); _repositoryMonitor = repositoryMonitor ?? throw new ArgumentNullException(nameof(repositoryMonitor)); } @@ -47,11 +45,7 @@ private IEnumerable Map(RepositoryActionPinRepositoryV1? a yield break; } - var name = action.Name ?? string.Empty; - if (!string.IsNullOrEmpty(name)) - { - name = NameHelper.EvaluateName(action.Name, repository, _translationService, _expressionEvaluator); - } + var name = _expressionEvaluator.EvaluateNullStringExpression(action.Name, repository); var currentlyPinned = _repositoryMonitor.IsPinned(repository); @@ -69,14 +63,6 @@ private IEnumerable Map(RepositoryActionPinRepositoryV1? a }; } - Git.RepositoryAction CreateAction(string name, Repository repository, bool newPinnedValue) - { - return new Git.RepositoryAction(name, repository) - { - Action = new DelegateAction((_, _) => _repositoryMonitor.SetPinned(newPinnedValue, repository)), - }; - } - yield return action.Mode switch { RepositoryActionPinRepositoryV1.PinMode.Toggle => CreateAction(name, repository, !currentlyPinned), @@ -84,5 +70,13 @@ Git.RepositoryAction CreateAction(string name, Repository repository, bool newPi RepositoryActionPinRepositoryV1.PinMode.UnPin => CreateAction(name, repository, false), _ => throw new NotImplementedException(), }; + + Git.RepositoryAction CreateAction(string actionName, Repository repo, bool newPinnedValue) + { + return new Git.RepositoryAction(actionName, repo) + { + Action = new DelegateAction((_, _) => _repositoryMonitor.SetPinned(newPinnedValue, repo)), + }; + } } } \ No newline at end of file From 7061d3c1a12e90e7c9262650d286fad09ccbe73a Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:06:34 +0200 Subject: [PATCH 14/17] Remove NameHelper --- src/RepoM.Api/IO/NameHelper.cs | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/RepoM.Api/IO/NameHelper.cs diff --git a/src/RepoM.Api/IO/NameHelper.cs b/src/RepoM.Api/IO/NameHelper.cs deleted file mode 100644 index 4e87a258..00000000 --- a/src/RepoM.Api/IO/NameHelper.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace RepoM.Api.IO; - -using RepoM.Api.Common; -using RepoM.Api.Git; -using RepoM.Core.Plugin.Expressions; - -public static class NameHelper -{ - public static string EvaluateName(in string? input, in Repository repository, ITranslationService translationService, IRepositoryExpressionEvaluator repositoryExpressionEvaluator) - { - return input == null ? string.Empty : repositoryExpressionEvaluator.EvaluateStringExpression(input, repository); - } -} \ No newline at end of file From 10ef472b7ed6df26c8191340e326ba143cac25ca Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:09:08 +0200 Subject: [PATCH 15/17] Update tests --- .../RepoM.Plugin.AzureDevOps.Tests/AzureDevOpsPackageTests.cs | 1 - .../ActionProvider/ActionClipboardCopyV1MapperTests.cs | 4 ---- tests/RepoM.Plugin.Clipboard.Tests/ClipboardPackageTests.cs | 1 - tests/RepoM.Plugin.Heidi.Tests/HeidiPackageTest.cs | 2 -- tests/RepoM.Plugin.SonarCloud.Tests/SonarCloudPackageTest.cs | 1 - 5 files changed, 9 deletions(-) diff --git a/tests/RepoM.Plugin.AzureDevOps.Tests/AzureDevOpsPackageTests.cs b/tests/RepoM.Plugin.AzureDevOps.Tests/AzureDevOpsPackageTests.cs index 84e17e10..d043cfe6 100644 --- a/tests/RepoM.Plugin.AzureDevOps.Tests/AzureDevOpsPackageTests.cs +++ b/tests/RepoM.Plugin.AzureDevOps.Tests/AzureDevOpsPackageTests.cs @@ -107,7 +107,6 @@ private void RegisterExternals(Container container) { container.RegisterSingleton(A.Dummy); container.RegisterSingleton(A.Dummy); - container.RegisterSingleton(A.Dummy); container.RegisterInstance(_appSettingsService); container.RegisterSingleton(A.Dummy); } diff --git a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs index 72dabfc3..9a0e9c36 100644 --- a/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs +++ b/tests/RepoM.Plugin.Clipboard.Tests/ActionProvider/ActionClipboardCopyV1MapperTests.cs @@ -6,7 +6,6 @@ namespace RepoM.Plugin.Clipboard.Tests.ActionProvider; using System.Threading.Tasks; using FakeItEasy; using FluentAssertions; -using RepoM.Api.Common; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider.ActionMappers; using RepoM.Core.Plugin.Expressions; @@ -34,7 +33,6 @@ public ActionClipboardCopyV1MapperTests() _actionMapperComposition = new ActionMapperComposition(new List(), A.Dummy()); _repository = new Repository("dummy"); IRepositoryExpressionEvaluator expressionEvaluator = A.Fake(); - ITranslationService translationService = A.Fake(); _sut = new ActionClipboardCopyV1Mapper(expressionEvaluator); @@ -56,8 +54,6 @@ public ActionClipboardCopyV1MapperTests() throw new Exception("Thrown by test, Not expected"); }); - A.CallTo(() => translationService.Translate(A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "unexpected by test."); - A.CallTo(() => translationService.Translate(A._, A._)).ReturnsLazily(call => call.Arguments[0] as string ?? "unexpected by test."); } [Fact] diff --git a/tests/RepoM.Plugin.Clipboard.Tests/ClipboardPackageTests.cs b/tests/RepoM.Plugin.Clipboard.Tests/ClipboardPackageTests.cs index 3e16dd17..1e3272c8 100644 --- a/tests/RepoM.Plugin.Clipboard.Tests/ClipboardPackageTests.cs +++ b/tests/RepoM.Plugin.Clipboard.Tests/ClipboardPackageTests.cs @@ -43,7 +43,6 @@ public void RegisterServices_ShouldFail_WhenExternalDependenciesAreNotRegistered private static void RegisterExternals(Container container) { container.RegisterSingleton(A.Dummy); - container.RegisterSingleton(A.Dummy); } } diff --git a/tests/RepoM.Plugin.Heidi.Tests/HeidiPackageTest.cs b/tests/RepoM.Plugin.Heidi.Tests/HeidiPackageTest.cs index 8fd2eba9..c55c06ae 100644 --- a/tests/RepoM.Plugin.Heidi.Tests/HeidiPackageTest.cs +++ b/tests/RepoM.Plugin.Heidi.Tests/HeidiPackageTest.cs @@ -5,7 +5,6 @@ namespace RepoM.Plugin.Heidi.Tests; using System.Threading.Tasks; using FakeItEasy; using Microsoft.Extensions.Logging; -using RepoM.Api.Common; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Core.Plugin; using RepoM.Core.Plugin.Expressions; @@ -107,6 +106,5 @@ private static void RegisterExternals(Container container) container.RegisterSingleton(A.Dummy); container.RegisterSingleton(A.Dummy); container.RegisterSingleton(A.Dummy); - container.RegisterSingleton(A.Dummy); } } \ No newline at end of file diff --git a/tests/RepoM.Plugin.SonarCloud.Tests/SonarCloudPackageTest.cs b/tests/RepoM.Plugin.SonarCloud.Tests/SonarCloudPackageTest.cs index 958dd28f..f12ea5aa 100644 --- a/tests/RepoM.Plugin.SonarCloud.Tests/SonarCloudPackageTest.cs +++ b/tests/RepoM.Plugin.SonarCloud.Tests/SonarCloudPackageTest.cs @@ -87,6 +87,5 @@ private void RegisterExternals(Container container) { container.RegisterInstance(_appSettingsService); container.RegisterSingleton(A.Dummy); - container.RegisterSingleton(A.Dummy); } } \ No newline at end of file From ff5b153f148c18d1997148e1b1981e008b826060 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:26:26 +0200 Subject: [PATCH 16/17] .. --- .../ActionMappers/ActionBrowseRepositoryV1Mapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowseRepositoryV1Mapper.cs b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowseRepositoryV1Mapper.cs index 55b3ae4e..11b06d3a 100644 --- a/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowseRepositoryV1Mapper.cs +++ b/src/RepoM.Api/IO/ModuleBasedRepositoryActionProvider/ActionMappers/ActionBrowseRepositoryV1Mapper.cs @@ -50,7 +50,7 @@ private IEnumerable Map(RepositoryActionBrowseRepositoryV1? ac } } - private RepositoryAction? CreateBrowseRemoteAction(Repository repository, RepositoryActionBrowseRepositoryV1 action) + private RepositoryAction? CreateBrowseRemoteAction(IRepository repository, RepositoryActionBrowseRepositoryV1 action) { if (repository.Remotes.Count == 0) { From 18ec0978538903f9990d6acd46db77e577cc7f56 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sun, 10 Sep 2023 10:36:38 +0200 Subject: [PATCH 17/17] .. --- .../DefaultAppSettingsTests/DocsAppSettingsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs b/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs index 160d2298..7d5c3ec4 100644 --- a/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs +++ b/tests/RepoM.Plugin.Misc.Tests/DefaultAppSettingsTests/DocsAppSettingsTests.cs @@ -56,7 +56,7 @@ public async Task AppSettingsDocumentationGeneration() }; AssemblyMembers members = DocReader.Read(typeof(AppSettings).Assembly, options); #else - var members = new DocumentMembers(System.Xml.Linq.XDocument.Parse(""), Array.Empty()); + var members = new DocumentMembers(System.Xml.Linq.XDocument.Parse(""), System.Array.Empty()); #endif var visitor = new AppSettingsMarkdownVisitor();