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); }
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); }
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); }
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); }
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); }
private bool ExcludeProjectCommand(SimpleCommandElement element) { Properties[Settings.PROP_EXCLUDE] = "true"; return(true); }