Beispiel #1
0
        public void Required()
        {
            var printer = new Printer();
            var sample = new Sample_07 { Printer = printer };

            Parser.Run(new[]
            {
                "print",
                "/prefix:hello",
            }, sample);

            Assert.AreEqual(1, printer.PrintedTexts.Count);
            Assert.AreEqual("HELLO", printer.PrintedTexts[0]);
        }
Beispiel #2
0
        public void Required_Exception()
        {
            var printer = new Printer();
            var sample = new Sample_07 { Printer = printer };

            Expect(() => Parser.Run(new[]
                                        {
                                            "print",
                                            "/message:world",
                                        }, sample),
                   Throws.InstanceOf<CommandLineParserException>());
        }
Beispiel #3
0
        public void Required_Exception()
        {
            try
            {
                var printer = new Printer();
                var sample = new Sample_07 { Printer = printer };

                Parser.Run(new[]
                {
                    "print",
                    "/message:world",
                }, sample);

                Assert.Fail();
            }
            catch (CommandLineException)
            {
            }
        }