< Summary

Information
Class: Orchestrator.Commands.Utility.CopyFirestoreContext.CopyFirestoreContextSettings
Assembly: Orchestrator
File(s): /home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Utility/CopyFirestoreContext/CopyFirestoreContextSettings.cs
Line coverage
63%
Covered lines: 7
Uncovered lines: 4
Coverable lines: 11
Total lines: 63
Line coverage: 63.6%
Branch coverage
40%
Covered branches: 4
Total branches: 10
Branch coverage: 40%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
Validate()40%191055.56%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Utility/CopyFirestoreContext/CopyFirestoreContextSettings.cs

#LineLine coverage
 1using System.ComponentModel;
 2using Spectre.Console;
 3using Spectre.Console.Cli;
 4
 5namespace Orchestrator.Commands.Utility.CopyFirestoreContext;
 6
 7public sealed class CopyFirestoreContextSettings : CommandSettings
 8{
 9    [CommandOption("--source-community-context <COMMUNITY_CONTEXT>")]
 10    [Description("Community context to copy documents from")]
 111    public string SourceCommunityContext { get; set; } = string.Empty;
 12
 13    [CommandOption("--target-community-context <COMMUNITY_CONTEXT>")]
 14    [Description("Community context to copy documents to")]
 115    public string TargetCommunityContext { get; set; } = string.Empty;
 16
 17    [CommandOption("--competition <COMPETITION>")]
 18    [Description("Competition identifier")]
 19    public string? Competition { get; set; }
 20
 21    [CommandOption("--context-prefix <PREFIX>")]
 22    [Description("Comma-separated context document prefixes to copy")]
 23    public string? ContextPrefix { get; set; }
 24
 25    [CommandOption("--kpi-document <DOCUMENT_NAME>")]
 26    [Description("Comma-separated KPI document names to copy")]
 27    public string? KpiDocument { get; set; }
 28
 29    [CommandOption("--dry-run")]
 30    [Description("Validate and show the copy plan without writing Firestore documents")]
 31    [DefaultValue(false)]
 32    public bool DryRun { get; set; }
 33
 34    [CommandOption("-v|--verbose")]
 35    [Description("Enable verbose output")]
 36    [DefaultValue(false)]
 37    public bool Verbose { get; set; }
 38
 39    public override ValidationResult Validate()
 40    {
 141        if (string.IsNullOrWhiteSpace(SourceCommunityContext))
 42        {
 043            return ValidationResult.Error("--source-community-context is required");
 44        }
 45
 146        if (string.IsNullOrWhiteSpace(TargetCommunityContext))
 47        {
 048            return ValidationResult.Error("--target-community-context is required");
 49        }
 50
 151        if (string.Equals(SourceCommunityContext, TargetCommunityContext, StringComparison.OrdinalIgnoreCase))
 52        {
 053            return ValidationResult.Error("source and target community contexts must differ");
 54        }
 55
 156        if (string.IsNullOrWhiteSpace(ContextPrefix) && string.IsNullOrWhiteSpace(KpiDocument))
 57        {
 058            return ValidationResult.Error("at least one of --context-prefix or --kpi-document is required");
 59        }
 60
 161        return ValidationResult.Success();
 62    }
 63}

Methods/Properties

.ctor()
Validate()