Exemple #1
0
        public void OptionCollection_AddLookupOptArgs_AddsOptionHandlerWithOptArgsComparer() // OPT_
        {
            Option option1 = new Option("name_1");                                           // WantsArgs = no
            Option option2 = new Option("name_2_");                                          // WantsArgs = yes

            OptionCollection optionCollection = new OptionCollection();

            optionCollection.Add(option1);
            optionCollection.Add(option2);

            optionCollection.AddLookupOptArgs("name_1", "q");
            optionCollection.AddLookupOptArgs("name_2_", "w");

            Option result11 = optionCollection.LookupOption("name_1");
            Option result12 = optionCollection.LookupOption("name-1");
            Option result13 = optionCollection.LookupOption("q");

            Assert.Equal(option1, result11);
            Assert.Equal(option1, result12);
            Assert.Equal(option1, result13);

            Option result21 = optionCollection.LookupOption("name_2");
            Option result22 = optionCollection.LookupOption("name-2");
            Option result23 = optionCollection.LookupOption("w");
            Option result24 = optionCollection.LookupOption("w_");

            Assert.Equal(option2, result21);
            Assert.Equal(option2, result22);
            Assert.Equal(option2, result23);
            Assert.Equal(option2, result24);
        }