refactor: Rename ConfigListCategory enum

pull/201/head
Robert Dailey 2 years ago
parent 579cadb9db
commit ca941ac31d

@ -20,9 +20,9 @@ public class ConfigListCommand : AsyncCommand<ConfigListCommand.CliSettings>
public class CliSettings : BaseCommandSettings
{
[CommandArgument(0, "[ListCategory]")]
[EnumDescription<ConfigListCategory>(
[EnumDescription<ConfigCategory>(
"The type of configuration information to list. If not specified, defaults to 'local'.")]
public ConfigListCategory ListCategory { get; [UsedImplicitly] init; } = ConfigListCategory.Local;
public ConfigCategory ListCategory { get; [UsedImplicitly] init; } = ConfigCategory.Local;
}
public ConfigListCommand(ILogger log, ConfigListProcessor processor)

@ -7,12 +7,12 @@ namespace Recyclarr.Cli.Processors.Config;
public class ConfigListProcessor
{
private readonly ILogger _log;
private readonly IIndex<ConfigListCategory, IConfigLister> _configListers;
private readonly IIndex<ConfigCategory, IConfigLister> _configListers;
private readonly IConfigTemplatesRepo _repo;
public ConfigListProcessor(
ILogger log,
IIndex<ConfigListCategory, IConfigLister> configListers,
IIndex<ConfigCategory, IConfigLister> configListers,
IConfigTemplatesRepo repo)
{
_log = log;
@ -20,9 +20,9 @@ public class ConfigListProcessor
_repo = repo;
}
public async Task Process(ConfigListCategory listCategory)
public async Task Process(ConfigCategory listCategory)
{
if (listCategory == ConfigListCategory.Templates)
if (listCategory == ConfigCategory.Templates)
{
await _repo.Update();
}

@ -37,7 +37,7 @@ public class ConfigAutofacModule : Module
builder.RegisterType<ConfigParser>();
// Config Listers
builder.RegisterType<ConfigTemplateLister>().Keyed<IConfigLister>(ConfigListCategory.Templates);
builder.RegisterType<ConfigLocalLister>().Keyed<IConfigLister>(ConfigListCategory.Local);
builder.RegisterType<ConfigTemplateLister>().Keyed<IConfigLister>(ConfigCategory.Templates);
builder.RegisterType<ConfigLocalLister>().Keyed<IConfigLister>(ConfigCategory.Local);
}
}

@ -1,6 +1,6 @@
namespace Recyclarr.TrashLib.Config.Listers;
public enum ConfigListCategory
public enum ConfigCategory
{
Local,
Templates

@ -10,10 +10,10 @@ namespace Recyclarr.Cli.Tests.Processors;
public class ConfigListProcessorTest
{
[Test]
[InlineAutoMockData(ConfigListCategory.Templates)]
[InlineAutoMockData(ConfigCategory.Templates)]
public async Task List_templates_invokes_correct_lister(
ConfigListCategory category,
[Frozen(Matching.ImplementedInterfaces)] StubAutofacIndex<ConfigListCategory, IConfigLister> configListers,
ConfigCategory category,
[Frozen(Matching.ImplementedInterfaces)] StubAutofacIndex<ConfigCategory, IConfigLister> configListers,
IConfigLister lister,
ConfigListProcessor sut)
{

@ -8,15 +8,15 @@ namespace Recyclarr.TrashLib.Tests.Config;
[Parallelizable(ParallelScope.All)]
public class ConfigAutofacModuleTest : TrashLibIntegrationFixture
{
private static IEnumerable<ConfigListCategory> AllConfigListCategories()
private static IEnumerable<ConfigCategory> AllConfigListCategories()
{
return Enum.GetValues<ConfigListCategory>();
return Enum.GetValues<ConfigCategory>();
}
[TestCaseSource(nameof(AllConfigListCategories))]
public void All_list_category_types_registered(ConfigListCategory category)
public void All_list_category_types_registered(ConfigCategory category)
{
var sut = Resolve<IIndex<ConfigListCategory, IConfigLister>>();
var sut = Resolve<IIndex<ConfigCategory, IConfigLister>>();
var result = sut.TryGetValue(category, out _);
result.Should().BeTrue();
}

Loading…
Cancel
Save