Esempio n. 1
0
        public void TestPickyAtMostOne()
        {
            var options = new PickyOptions();

            var parser = new CommandLineParser(options);

            parser.Parse("/Option1AtMostOne:aa /Option2AtMostOne:bb /Option1AtLeastOne:ab /Option2AtLeastOne:kk /Option1ExactlyOne:eee /Option1All:ttt /Option2All:ggg", false);
            var s = parser.ErrorMessage;

            System.Diagnostics.Debug.WriteLine(s);
            Assert.AreEqual(1, s.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Length);
        }
Esempio n. 2
0
        public void TestPickyAllPropertiesAssignedInvalid()
        {
            var options = new PickyOptions();

            var parser = new CommandLineParser(options);

            parser.Parse("/Option1AtMostOne:aa /Option2AtMostOne:bb  ", false);
            var s = parser.ErrorMessage;

            System.Diagnostics.Debug.WriteLine(s);
            Assert.AreEqual(4, s.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Length);
        }
Esempio n. 3
0
        public void TestPickyAll()
        {
            var options = new PickyOptions()
            {
                Option1AtMostOne = "aa",
                //      Option2AtMostOne = "bb",

                Option1AtLeastOne = "ab",
                //      Option2AtLeastOne = "kk",

                Option1ExactlyOne = "eee",
                //       Option2ExactlyOne = "nnn",

                Option1All = "ttt",
                //       Option2All = "33fdf",
            };

            var s = OptionsValidator.AnalyzeAssignedOptions(options);

            System.Diagnostics.Debug.WriteLine(s);
            Assert.AreEqual(1, s.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Length);
        }