当前位置: 首页>>代码示例>>C#>>正文


C# Parser.parseArgs方法代码示例

本文整理汇总了C#中Parser.parseArgs方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.parseArgs方法的具体用法?C# Parser.parseArgs怎么用?C# Parser.parseArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser.parseArgs方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestOptionTimeWithValue

        public void TestOptionTimeWithValue()
        {
            string[] args = new string[]{"test","-url","http://horloge.parlante.online.fr/","-times","5"};
            Parser p =  new Parser(args);
            p.parseArgs();

            Assert.IsFalse(p.Log.HasError);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:8,代码来源:ParserTest.cs

示例2: GetWithSaveOption

        public void GetWithSaveOption()
        {
            string[] args = new string[]{"get","-url","http://horloge.parlante.online.fr/","-save","C:/Bonjour.txt"};
            Parser p =  new Parser(args);
            p.parseArgs();

            Assert.IsFalse(p.Log.HasError,"Erreur rencontrée durant le traitement des arguments");
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:8,代码来源:ParserTest.cs

示例3: GetWithoutUrlOption

        public void GetWithoutUrlOption()
        {
            string[] args = new string[]{"get","-save","C:/Bonjour.txt"};
            Parser p =  new Parser(args);
            p.parseArgs();

            Assert.IsTrue(p.Log.HasError);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:8,代码来源:ParserTest.cs

示例4: GetWithFakeUrl

        public void GetWithFakeUrl()
        {
            string[] args = new string[]{"get","-url","http://horloge.parlaERREURURLnte.online.fr/","-save","C:/Bonjour.txt"};
            Parser p =  new Parser(args);
            p.parseArgs();

            Assert.AreEqual(p.Log.Message.ToString(),"L'url entrée n'existe pas.\r\n");
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:8,代码来源:ParserTest.cs

示例5: GetOptionUrlWithoutValue

        public void GetOptionUrlWithoutValue()
        {
            string[] args = new string[]{"get","-url"};
            Parser p =  new Parser(args);
            p.parseArgs();

            Assert.IsTrue(p.Log.HasError);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:8,代码来源:ParserTest.cs

示例6: Should_Display_Good_Text

        public void Should_Display_Good_Text()
        {
            string[] args = new string[]{"get","-url","http://webbdoger93.free.fr/testNurl/hello.html"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            Assert.AreEqual("<h1>Hello test<h1>",c.executeGet());
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:9,代码来源:CoreTest.cs

示例7: Should_Display_Error_On_Fake_Url

        public void Should_Display_Error_On_Fake_Url()
        {
            string[] args = new string[]{"get","-url","http://horloge.parlante.onlineERREUR.fr/"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            Assert.AreEqual("<h1>You're entered a fake url</h1>",c.executeGet());
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:9,代码来源:CoreTest.cs

示例8: Should_Fill_File_With_Good_Text

        public void Should_Fill_File_With_Good_Text()
        {
            string[] args = new string[]{"get","-url","http://webbdoger93.free.fr/testNurl/hello.html","-save","C:/Bonjour.txt"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            Assert.IsTrue(c.executeSave());

            Assert.AreEqual(File.Exists(args[4]),true);
            string content = String.Empty;
            using(FileStream fs = new FileStream(args[4],FileMode.Open)){
                using(StreamReader sr = new StreamReader(fs)){
                    content=sr.ReadToEnd();
                }
            }

            Assert.AreEqual("<h1>Hello test<h1>",content);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:19,代码来源:CoreTest.cs

示例9: Should_Create_File_And_Fill

        public void Should_Create_File_And_Fill()
        {
            string[] args = new string[] {"get","-url","http://horloge.parlante.online.fr/","-save","C:/bonjour.txt"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            c.executeCommand();

            Assert.AreEqual(File.Exists(args[4]),true);

            string content;

            using(FileStream fs = new FileStream(args[4],FileMode.Open)){
                using(StreamReader sr = new StreamReader(fs)){
                    content = sr.ReadToEnd();
                }
            }

            Assert.IsNotNullOrEmpty(content);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:21,代码来源:CoreTest.cs

示例10: Should_Have_Good_Number_Of_Results

        public void Should_Have_Good_Number_Of_Results()
        {
            string[] args = new string[]{"test","-url","http://horloge.parlante.online.fr/","-times","5"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            Assert.AreEqual(Int32.Parse(args[4]),c.executeTest().Count);
        }
开发者ID:rayanesgi,项目名称:CSharpProjectsExercices,代码行数:9,代码来源:CoreTest.cs


注:本文中的Parser.parseArgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。