本文整理汇总了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);
}
示例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");
}
示例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);
}
示例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");
}
示例5: GetOptionUrlWithoutValue
public void GetOptionUrlWithoutValue()
{
string[] args = new string[]{"get","-url"};
Parser p = new Parser(args);
p.parseArgs();
Assert.IsTrue(p.Log.HasError);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}