예제 #1
0
        public void GetArgumentValuesT_ArgumentPassedWithSomeInvalidTypeValues_ReturnsOnlyValidValuesFortype()
        {
            IEnumerable<string> args = "/ab /cd 1 Z 3 /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with two valid numeric values, one invalid non-numeric
            int[] actual = target.GetArgumentValues<int>(argument).ToArray(); //force evaluation of conversion

            Assert.AreEqual(2, actual.Count());
        }
예제 #2
0
        public void GetArgumentValuesT_ArgumentPassedWithNonParseableType_ThrowsException()
        {
            IEnumerable<string> args = "/ab /cd 1-2-2012 /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with date value, but NonStringParseable type cannot convert from string
            NonStringParseable[] actual = target.GetArgumentValues<NonStringParseable>(argument).ToArray(); //force evaluation of conversion

            Assert.Fail("Expected Exception not thrown");
        }
예제 #3
0
        public void GetArgumentValuesT_ArgumentPassedWithValues_ValuesReturned()
        {
            IEnumerable<string> args = "/ab /cd 1 2 /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with two values
            int[] actual = target.GetArgumentValues<int>(argument).ToArray(); //force evaluation of conversion

            Assert.AreEqual(2, actual.Count());
        }
예제 #4
0
        public void GetArgumentValuesT_ArgumentPassedWithInvalidTypeValues_NoValuesReturned()
        {
            IEnumerable<string> args = "/ab /cd XYZ /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with non-numeric value
            int[] actual = target.GetArgumentValues<int>(argument).ToArray(); //force evaluation of conversion

            Assert.IsFalse(actual.Any());
        }
예제 #5
0
        public void GetArgumentValuesT_NoArgumentsPassed_NoValuesReturned()
        {
            IEnumerable<string> args = null;
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "TEST";
            int[] actual = target.GetArgumentValues<int>(argument).ToArray(); //force evaluation of conversion

            Assert.IsFalse(actual.Any());
        }
예제 #6
0
        public void GetArgumentValuesT_ArgumentNotPassed_NoValuesReturned()
        {
            IEnumerable<string> args = @"/a 1 /b 2".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "c"; //this arg not passed in
            int[] actual = target.GetArgumentValues<int>(argument).ToArray(); //force evaluation of conversion

            Assert.IsFalse(actual.Any());
        }
예제 #7
0
        public void GetArgumentValues_ValuesPassedBeforeArgumentName_ParsedUnderEmptyStringArgumentName()
        {
            IEnumerable<string> args = "1 2 /a /b".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = ""; //passed with two values
            IEnumerable<string> actual = target.GetArgumentValues(argument);

            Assert.IsTrue(actual.Contains("1"));
            Assert.IsTrue(actual.Contains("2"));
            Assert.AreEqual(2, actual.Count());
        }
예제 #8
0
        public void GetArgumentValues_ArgumentPassedWithValues_ValuesReturned()
        {
            IEnumerable<string> args = "/ab /cd 1 2 /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with two values
            IEnumerable<string> actual = target.GetArgumentValues(argument);

            Assert.AreEqual(2, actual.Count());
        }
예제 #9
0
        public void GetArgumentValues_ArgumentPassedWithNoValues_EmptyList()
        {
            IEnumerable<string> args = "/ab /cd /ef".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "cd"; //passed with no values
            IEnumerable<string> actual = target.GetArgumentValues(argument);

            Assert.IsFalse(actual.Any());
        }
예제 #10
0
        public void GetArgumentValues_ArgumentNotPassed_ReturnsEmptyList()
        {
            IEnumerable<string> args = @"/a 1 /b 2".Split(' ');
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "c"; //this arg not passed in
            IEnumerable<string> actual = target.GetArgumentValues(argument);

            Assert.IsFalse(actual.Any());
        }
예제 #11
0
        public void GetArgumentValues_NoArgumentsPassed_ReturnsEmptyList()
        {
            IEnumerable<string> args = null;
            CommandLineArguments target = new CommandLineArguments(args);

            string argument = "TEST";
            IEnumerable<string> actual = target.GetArgumentValues(argument);

            Assert.IsFalse(actual.Any());
        }