コード例 #1
0
        public IEnumerable <ValidationCondition> Validate(GraphSettings repoActionSettings)
        {
            var trueCount = _trueCounter.GetCount(repoActionSettings.Compile, repoActionSettings.Export);

            if (trueCount == 0)
            {
                yield return(new ValidationCondition("No action specified", ValidationConditionLevel.Error));
            }

            if (trueCount > 1)
            {
                yield return(new ValidationCondition("Too many actions specified", ValidationConditionLevel.Error));
            }
        }
コード例 #2
0
        public IEnumerable <ValidationCondition> Validate(RepoActionSettings settings)
        {
            var trueCount = _trueCounter.GetCount(settings.ActionSwitches.ToArray());

            if (!settings.Help && trueCount == 0)
            {
                yield return(new ValidationCondition("No action specified", ValidationConditionLevel.Error));
            }

            if (trueCount > 1)
            {
                yield return(new ValidationCondition("Too many actions specified", ValidationConditionLevel.Error));
            }
        }
コード例 #3
0
        public IEnumerable <ValidationCondition> Validate(SwitchToNugetSettings settings)
        {
            var count = _trueCounter.GetCount(settings.Project, settings.Assembly);

            if (count == 0)
            {
                yield return(new ValidationCondition("Missing required argument: assembly or project", ValidationConditionLevel.Error));
            }

            if (count > 1)
            {
                yield return(new ValidationCondition("Multiple arguments specified: assembly and project", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.Directory))
            {
                yield return(new ValidationCondition("Missing required argument: directory", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.ItemName))
            {
                yield return(new ValidationCondition("Missing required argument: item name", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.PackageName))
            {
                yield return(new ValidationCondition("Missing required argument: package name", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.PackagePath))
            {
                yield return(new ValidationCondition("Missing required argument: package path", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.PackageVersion))
            {
                yield return(new ValidationCondition("Missing required argument: package version", ValidationConditionLevel.Error));
            }
        }
コード例 #4
0
        public IEnumerable <ValidationCondition> Validate(RemoveReferenceSettings settings)
        {
            var count = _trueCounter.GetCount(settings.Project, settings.Assembly);

            if (count == 0)
            {
                yield return(new ValidationCondition("Missing required argument: assembly or project", ValidationConditionLevel.Error));
            }

            if (count > 1)
            {
                yield return(new ValidationCondition("Multiple arguments specified: assembly and project", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.Directory))
            {
                yield return(new ValidationCondition("Missing required argument: directory", ValidationConditionLevel.Error));
            }

            if (string.IsNullOrWhiteSpace(settings.ItemName))
            {
                yield return(new ValidationCondition("Missing required argument: item name", ValidationConditionLevel.Error));
            }
        }