private void CaptureArgumentErrors( List <ResolveCommandError> errors, ArgumentInfo argInfo, ParsedInputElement node) { var qualifier = node.ElementType == InputElementType.ArgumentName ? "name" : "alias"; if (argInfo == null) // argument not found { errors.Add(new ResolveCommandError { Type = CommandResolutionErrorType.ArgumentNotFound, Element = node, Message = $"No argument property matching {qualifier} \"{node.Raw}\" could be found." }); } else if (argInfo.DataType == typeof(Option) && node.IsPairedWith != null) // option found with a value { errors.Add(new ResolveCommandError { Type = CommandResolutionErrorType.UnexpectedValue, Element = node, Message = $"Argument \"{node.Raw}\" has an associated value, but resolves to a property of type {typeof(Option).FullName} (options can not have associated values)" }); } }
private void ValidateInputNode( ParsedInputElement node, string element, InputElementType type, int index, ParsedInputElement pairedWith, string value, int startPos = -1, int endPos = -1) { node.Raw.Should().Be(element); node.ElementType.Should().Be(type); node.Index.Should().Be(index); node.IsPairedWith.Should().Be(pairedWith); node.Value.Should().Be(value); if (startPos > -1) { node.StartPosition.Should().Be(startPos); } if (endPos > -1) { node.EndPosition.Should().Be(endPos); } }