/// <summary> /// Constructor. /// </summary> /// <param name="argSet">Argument set to create parser for.</param> /// <param name="options">Parser options.</param> public ArgumentSetParser(ArgumentSetDefinition argSet, CommandLineParserOptions options) { if (argSet == null) { throw new ArgumentNullException(nameof(argSet)); } // Clone the argument set definition, as parsing may mutate it. ArgumentSet = argSet.DeepClone(); // Save off the options provided; if none were provided, construct some quiet defaults. _options = options?.DeepClone() ?? CommandLineParserOptions.Quiet(); // If no reporter was provided, use a no-op one. if (_options.Reporter == null) { _options.Reporter = err => { }; } // If no file-system reader was provided, use our default implementation. if (_options.FileSystemReader == null) { _options.FileSystemReader = FileSystemReader.Create(); } }
public void TestThatRequiredPropertiesArePresentInQuietOptions() { var options = CommandLineParserOptions.Quiet(); options.HelpOptions.Should().NotBeNull(); options.Reporter.Should().NotBeNull(); options.FileSystemReader.Should().NotBeNull(); }