From d3943b5bdc81b524b2f219a52d5eb602bd193981 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Sun, 25 Apr 2021 18:28:53 -0500 Subject: [PATCH] style: code cleanup --- .../ReleaseProfile/FilteredProfileDataTest.cs | 22 ++++++++-------- src/Trash/Command/CliTypeActivator.cs | 2 +- src/Trash/Command/ServiceCommand.cs | 26 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs b/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs index 684299ac..593df6f2 100644 --- a/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs +++ b/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs @@ -11,10 +11,10 @@ namespace Trash.Tests.Sonarr.ReleaseProfile public class FilteredProfileDataTest { [Test] - public void Filter_IncludeOptional_HasAllOptionalItems() + public void Filter_ExcludeOptional_HasNoOptionalItems() { var config = new ReleaseProfileConfig(); - config.Filter.IncludeOptional = true; + config.Filter.IncludeOptional = false; var profileData = new ProfileData { @@ -40,21 +40,20 @@ namespace Trash.Tests.Sonarr.ReleaseProfile filtered.Should().BeEquivalentTo(new { - Ignored = new List {"ignored1", "ignored2"}, - Required = new List {"required1", "required2"}, + Ignored = new List {"ignored1"}, + Required = new List {"required1"}, Preferred = new Dictionary> { - {100, new List {"preferred1", "preferred3"}}, - {200, new List {"preferred2"}} + {100, new List {"preferred1"}} } }); } [Test] - public void Filter_ExcludeOptional_HasNoOptionalItems() + public void Filter_IncludeOptional_HasAllOptionalItems() { var config = new ReleaseProfileConfig(); - config.Filter.IncludeOptional = false; + config.Filter.IncludeOptional = true; var profileData = new ProfileData { @@ -80,11 +79,12 @@ namespace Trash.Tests.Sonarr.ReleaseProfile filtered.Should().BeEquivalentTo(new { - Ignored = new List {"ignored1"}, - Required = new List {"required1"}, + Ignored = new List {"ignored1", "ignored2"}, + Required = new List {"required1", "required2"}, Preferred = new Dictionary> { - {100, new List {"preferred1"}} + {100, new List {"preferred1", "preferred3"}}, + {200, new List {"preferred2"}} } }); } diff --git a/src/Trash/Command/CliTypeActivator.cs b/src/Trash/Command/CliTypeActivator.cs index 266317ae..fdbfd26f 100644 --- a/src/Trash/Command/CliTypeActivator.cs +++ b/src/Trash/Command/CliTypeActivator.cs @@ -11,7 +11,7 @@ namespace Trash.Command if (instance.GetType().IsAssignableTo()) { var activeServiceProvider = container.Resolve(); - activeServiceProvider.ActiveCommand = (IServiceCommand)instance; + activeServiceProvider.ActiveCommand = (IServiceCommand) instance; } return instance; diff --git a/src/Trash/Command/ServiceCommand.cs b/src/Trash/Command/ServiceCommand.cs index b06adc4b..66277971 100644 --- a/src/Trash/Command/ServiceCommand.cs +++ b/src/Trash/Command/ServiceCommand.cs @@ -31,19 +31,6 @@ namespace Trash.Command protected ILogger Log { get; } - [CommandOption("preview", 'p', Description = - "Only display the processed markdown results without making any API calls.")] - public bool Preview { get; [UsedImplicitly] set; } = false; - - [CommandOption("debug", 'd', Description = - "Display additional logs useful for development/debug purposes.")] - public bool Debug { get; [UsedImplicitly] set; } = false; - - [CommandOption("config", 'c', Description = - "One or more YAML config files to use. All configs will be used and settings are additive. " + - "If not specified, the script will look for `trash.yml` in the same directory as the executable.")] - public List Config { get; [UsedImplicitly] set; } = new() {DefaultConfigPath}; - public async ValueTask ExecuteAsync(IConsole console) { SetupLogging(); @@ -72,6 +59,19 @@ namespace Trash.Command } } + [CommandOption("preview", 'p', Description = + "Only display the processed markdown results without making any API calls.")] + public bool Preview { get; [UsedImplicitly] set; } = false; + + [CommandOption("debug", 'd', Description = + "Display additional logs useful for development/debug purposes.")] + public bool Debug { get; [UsedImplicitly] set; } = false; + + [CommandOption("config", 'c', Description = + "One or more YAML config files to use. All configs will be used and settings are additive. " + + "If not specified, the script will look for `trash.yml` in the same directory as the executable.")] + public List Config { get; [UsedImplicitly] set; } = new() {DefaultConfigPath}; + private void SetupLogging() { _loggingLevelSwitch.MinimumLevel =