Пример #1
0
        public void RepeatingPathOption()
        {
            CommandLineUtilities.Option opt = default(CommandLineUtilities.Option);

            opt.Name  = "Switch";
            opt.Value = "test.dll";
            Assert.True(
                CommandLineUtilities.ParseRepeatingPathOption(opt, ",").SequenceEqual(
                    new string[]
            {
                Path.Combine(Directory.GetCurrentDirectory(), "test.dll")
            }));

            opt.Name  = "Switch";
            opt.Value = "test.dll,test2.dll";
            Assert.True(
                CommandLineUtilities.ParseRepeatingPathOption(opt, ",").SequenceEqual(
                    new string[]
            {
                Path.Combine(Directory.GetCurrentDirectory(), "test.dll"),
                Path.Combine(Directory.GetCurrentDirectory(), "test2.dll")
            }));

            Assert.Throws <InvalidArgumentException>(() =>
            {
                opt.Name  = "Switch";
                opt.Value = null;
                CommandLineUtilities.ParseStringOption(opt);
            });
        }