Exemplo n.º 1
0
Arquivo: Tests.cs Projeto: serra/CLAP
        public void Array_Strings_WithSeparator()
        {
            var printer = new Printer();
            var sample = new Sample_69 { Printer = printer };

            // array
            //
            Parser.Run(new[]
            {
                "print",
                "/messages:a|b|c",
                "/prefix:test_",
            }, sample);

            Expect(printer.PrintedTexts, Is.EqualTo(new[] {"test_a", "test_b", "test_c"}));

            sample.Printer.Reset();

            Parser.Run(new[]
            {
                "printnumbers",
                "/numbers:1-78-100",
                "/prefix:test_",
            }, sample);

            Expect(printer.PrintedTexts, Is.EqualTo(new[] { "test_1", "test_78", "test_100" }));
        }
Exemplo n.º 2
0
        public void Array_Strings_WithSeparator()
        {
            var printer = new Printer();
            var sample = new Sample_69 { Printer = printer };

            // array
            //
            Parser.Run(new[]
            {
                "print",
                "/messages:a|b|c",
                "/prefix:test_",
            }, sample);

            Assert.AreEqual(3, printer.PrintedTexts.Count);
            Assert.AreEqual("test_a", printer.PrintedTexts[0]);
            Assert.AreEqual("test_b", printer.PrintedTexts[1]);
            Assert.AreEqual("test_c", printer.PrintedTexts[2]);

            sample.Printer.Reset();

            Parser.Run(new[]
            {
                "printnumbers",
                "/numbers:1-78-100",
                "/prefix:test_",
            }, sample);

            Assert.AreEqual(3, printer.PrintedTexts.Count);
            Assert.AreEqual("test_1", printer.PrintedTexts[0]);
            Assert.AreEqual("test_78", printer.PrintedTexts[1]);
            Assert.AreEqual("test_100", printer.PrintedTexts[2]);
        }