コード例 #1
0
        [Trait(Traits.Style, "exploratory")] // Legacy Tests, replace when working on them.
        public void Basic_ArrayOfStrs_Works()
        {
            var clas = new CommandArgumentSupport {
                ArgumentPostfix        = ":",
                ArgumentPrefix         = "",
                ArgumentPrefixOptional = true
            };

            string[] parms = new string[] { "one", "two", "three", "four", "five" };

            string strArrayConcat = "";

            foreach (var f in parms)
            {
                strArrayConcat += f + ",";
            }


            var argsClass = new SampleCommandLine_C3();

            string[] args = new string[] {
                $"StrArray:{strArrayConcat}",
            };
            clas.ProcessArguments(argsClass, args);

            Assert.Equal(parms.Length, argsClass.StrArray.Length);
            for (int i = 0; i < parms.Length; i++)
            {
                Assert.Equal(parms[i], argsClass.StrArray[i]);
            }
        }
コード例 #2
0
        [Trait(Traits.Style, "exploratory")] // Legacy Tests, replace when working on them.
        public void Basic_ArrayOfInts_Works()
        {
            var clas = new CommandArgumentSupport {
                ArgumentPostfix        = ":",
                ArgumentPrefix         = "",
                ArgumentPrefixOptional = true
            };

            int[]  nums        = new int[] { 1, 2, 3, 4, 5 };
            string numsAsParam = "";

            foreach (var f in nums)
            {
                numsAsParam += f + ",";
            }

            var argsClass = new SampleCommandLine_C3();

            string[] args = new string[] {
                $"IntArray:{numsAsParam}",
            };

            clas.ProcessArguments(argsClass, args);

            Assert.Equal(nums.Length, argsClass.NumArray.Length);
            for (int i = 0; i < nums.Length; i++)
            {
                Assert.Equal(nums[i], argsClass.NumArray[i]);
            }
        }