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


C# Client.TerminatedRead方法代码示例

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


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

示例1: ShouldBePromptingForPassword

 public void ShouldBePromptingForPassword()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port, new System.Threading.CancellationToken()))
     {
       client.IsConnected.Should().Be(true);
       string s = client.TerminatedRead("Account:", TimeSpan.FromMilliseconds(TimeoutMs));
       s.Should().Contain("Account:");
       client.WriteLine("username");
       s = client.TerminatedRead("Password:", TimeSpan.FromMilliseconds(TimeoutMs));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:14,代码来源:WithClient.cs

示例2: ShouldTerminateWithAColon

 public void ShouldTerminateWithAColon()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port))
     {
       Assert.AreEqual(client.IsConnected, true);
       Assert.IsTrue(client.TerminatedRead(":", TimeSpan.FromMilliseconds(TimeoutMs)).EndsWith(":"));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:11,代码来源:WithClient.cs

示例3: ShouldRegexMatchWithAColon

 public void ShouldRegexMatchWithAColon()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port))
     {
       Assert.AreEqual(client.IsConnected, true);
       Regex regex = new Regex(".*:\r?$", RegexOptions.Multiline);
       Assert.IsTrue(client.TerminatedRead(regex, TimeSpan.FromMilliseconds(TimeoutMs)).EndsWith(":"));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:12,代码来源:WithClient.cs

示例4: ShouldRespondWithWan2Info

 public void ShouldRespondWithWan2Info()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port))
     {
       Assert.AreEqual(client.IsConnected, true);
       Assert.AreEqual(client.TryLogin("username", "password", TimeoutMs), true);
       client.WriteLine("show statistic wan2");
       string s = client.TerminatedRead(">", TimeSpan.FromMilliseconds(TimeoutMs));
       Assert.IsTrue(s.Contains(">"));
       Assert.IsTrue(s.Contains("WAN2"));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:15,代码来源:WithClient.cs

示例5: ShouldPromptForInput

 public void ShouldPromptForInput()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port))
     {
       Assert.AreEqual(client.IsConnected, true);
       client.TerminatedRead("Account:", TimeSpan.FromMilliseconds(TimeoutMs));
       client.WriteLine("username");
       client.TerminatedRead("Password:", TimeSpan.FromMilliseconds(TimeoutMs));
       client.WriteLine("password");
       client.TerminatedRead(">", TimeSpan.FromMilliseconds(TimeoutMs));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:15,代码来源:WithClient.cs

示例6: ShouldRegexMatchPromptingForAccount

 public void ShouldRegexMatchPromptingForAccount()
 {
   using (TelnetServer server = new TelnetServer())
   {
     using (Client client = new Client(server.IPAddress.ToString(), server.Port))
     {
       Assert.AreEqual(client.IsConnected, true);
       Regex regex = new Regex(".*Account:\r?$", RegexOptions.Multiline);
       string s = client.TerminatedRead(regex, TimeSpan.FromMilliseconds(TimeoutMs));
       Assert.IsTrue(s.Contains("Account:"));
     }
   }
 }
开发者ID:fireball87,项目名称:Telnet,代码行数:13,代码来源:WithClient.cs


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