Exemplo n.º 1
0
        public void TestBoolOption()
        {
            GetOpt parser = new GetOpt();

            parser.AddBoolOption(flags: new string[] { "-h", "-help" });

            Assert.False(parser.IsSet("-h"), "-h option should not be set");
            Assert.False(parser.IsSet("-help"), "-help option should not be set");

            string[] rest = parser.Parse(
                "-not option -help -file name bla bla -fbla".Split(" "));

            Assert.True(parser.IsSet("-h"), "-h option should be set");
            Assert.True(parser.IsSet("-help"), "-help option should be set");

            parser.Reset();

            Assert.False(parser.IsSet("-h"), "-h option should not be set");
            Assert.False(parser.IsSet("-help"), "-help option should not be set");
        }