public void ReturnsRawValuesForNonSpecifiedOptions()
        {
            var commandLineParser = CreateCommandLineParser();

            var context           = new TestContextWithFile();
            var validationContext = commandLineParser.Parse("somefile /nonspecified /nonspecified2 somevalue /bs /s somestring /i 42", context);

            Assert.AreEqual(string.Empty, context.RawValues["NonSpecified"]);
            Assert.AreEqual("somevalue", context.RawValues["NonSpecified2"]);
        }
        public void CorrectlyParsesCommandLineWithHelp(string input)
        {
            var commandLineParser = CreateCommandLineParser();

            var context           = new TestContextWithFile();
            var validationContext = commandLineParser.Parse(input, context);

            Assert.IsFalse(validationContext.HasErrors);
            Assert.IsFalse(validationContext.HasWarnings);

            Assert.IsTrue(context.IsHelp);
        }
        public void CorrectlyParsesCommandLineWithHelp(string input)
        {
            var commandLineParser = CreateCommandLineParser();

            var context = new TestContextWithFile();
            var validationContext = commandLineParser.Parse(input, context);

            Assert.IsFalse(validationContext.HasErrors);
            Assert.IsFalse(validationContext.HasWarnings);

            Assert.IsTrue(context.IsHelp);
        }
        public void CorrectlyParsesCommandLinesWithFile(string input, string expectedBooleanSwitch, string expectedIntegerSwitch,
                                                        string expectedStringSwitch, string expectedFileName)
        {
            var commandLineParser = CreateCommandLineParser();

            var context           = new TestContextWithFile();
            var validationContext = commandLineParser.Parse(input, context);

            Assert.IsFalse(validationContext.HasErrors);
            Assert.IsFalse(validationContext.HasWarnings);

            Assert.IsTrue(string.Equals(expectedBooleanSwitch, context.BooleanSwitch.ToString(), StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(string.Equals(expectedIntegerSwitch, context.IntegerSwitch.ToString(), StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(string.Equals(expectedStringSwitch, context.StringSwitch));
            Assert.IsTrue(string.Equals(expectedFileName, context.FileName));
        }
        public void CorrectlyParsesCommandLinesWithFile(string input, string expectedBooleanSwitch, string expectedIntegerSwitch,
            string expectedStringSwitch, string expectedFileName)
        {
            var commandLineParser = CreateCommandLineParser();

            var context = new TestContextWithFile();
            var validationContext = commandLineParser.Parse(input, context);

            Assert.IsFalse(validationContext.HasErrors);
            Assert.IsFalse(validationContext.HasWarnings);

            Assert.IsTrue(string.Equals(expectedBooleanSwitch, context.BooleanSwitch.ToString(), StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(string.Equals(expectedIntegerSwitch, context.IntegerSwitch.ToString(), StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(string.Equals(expectedStringSwitch, context.StringSwitch));
            Assert.IsTrue(string.Equals(expectedFileName, context.FileName));
        }