Пример #1
0
        public void CanParseSimpleCommandWithConditionalWithArgs()
        {
            const string         commandArgs = "ProjectName : SettingsName";
            string               input       = $"if (my-define) {Settings.CMD_DECLARE_PROJECT} \"{commandArgs}\"";
            SimpleCommandElement cmd         = DocumentParser.SimpleCommand.Parse(input);

            Assert.Equal(Settings.CMD_DECLARE_PROJECT, cmd.CommandName);
            Assert.Equal("my-define", cmd.ConditionalExpression);
            Assert.Equal(commandArgs, cmd.ArgumentStr);
        }
Пример #2
0
        public void CanParseSimpleCommandWithConditionalWithoutArgs()
        {
            string input             = $"if (my-define) {Settings.CMD_SKIP}";
            SimpleCommandElement cmd = DocumentParser.SimpleCommand.Parse(input);

            Assert.NotNull(cmd);
            Assert.Equal(Settings.CMD_SKIP, cmd.CommandName);
            Assert.Equal("my-define", cmd.ConditionalExpression);
            Assert.Equal(string.Empty, cmd.ArgumentStr);
        }
Пример #3
0
        public void CanParseSimpleCommandWithoutConditionalWithoutArgs()
        {
            const string         input = Settings.CMD_SKIP;
            SimpleCommandElement cmd   = DocumentParser.SimpleCommand.Parse(input);

            Assert.NotNull(cmd);
            Assert.Equal(Settings.CMD_SKIP, cmd.CommandName);
            Assert.Equal("true", cmd.ConditionalExpression);
            Assert.Equal(string.Empty, cmd.ArgumentStr);
        }
Пример #4
0
        private bool ProjectDeclarationCommand(SimpleCommandElement element)
        {
            object projects           = Properties[Settings.PROP_PROJECT_DELCARATIONS];
            var    projectsDefinition =
                (PropertyCollectionDefinition)propertyDefinitionLookup[Settings.PROP_PROJECT_DELCARATIONS];

            projectsDefinition.AddToCollection(projects, element.ArgumentStr);
            VisitedProperties.Add(Settings.PROP_PROJECT_DELCARATIONS);

            return(false);
        }
Пример #5
0
        private bool ReadCommand(SimpleCommandElement element)
        {
            if (!CommandDefinitionLookup.TryGetValue(element.CommandName, out CommandDefinition definition))
            {
                throw new UnrecognizedCommandException(element);
            }

            ElementReader.IResult <IEnumerable <object> > result =
                definition.Reader.EvaluateAndRead(element, definition, conditionalParser);

            return(result.Terminate);
        }
Пример #6
0
 private bool ExcludeProjectCommand(SimpleCommandElement element)
 {
     Properties[Settings.PROP_EXCLUDE] = "true";
     return(true);
 }