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));
            }
        }
        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));
            }
        }
Exemple #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));
            }
        }
Exemple #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));
            }
        }