コード例 #1
0
ファイル: WithClient.cs プロジェクト: mwsoverdick/Telnet
 public void ShouldLoginCrLf()
 {
     using (var server = new TelnetServerRFC854())
     {
         using (Client client = new Client(server.IPAddress.ToString(), server.Port))
         {
             Assert.AreEqual(client.IsConnected, true);
             Assert.AreEqual((client.TryLogin("username", "password", timeoutMs, linefeed: "\r\n")), true);
         }
     }
 }
コード例 #2
0
ファイル: WithClient.cs プロジェクト: mwsoverdick/Telnet
 public async Task ShouldLoginCrLf()
 {
     using (var server = new TelnetServerRFC854())
     {
         using (Client client = new Client(server.IPAddress.ToString(), server.Port, new System.Threading.CancellationToken()))
         {
             client.IsConnected.Should().Be(true);
             (await client.TryLoginAsync("username", "password", timeoutMs, linefeed: "\r\n").ConfigureAwait(false)).Should().Be(true);
         }
     }
 }
コード例 #3
0
ファイル: WithClient.cs プロジェクト: Tryweirder/Telnet-1
 public void ShouldLoginCrLf()
 {
     using (var server = new TelnetServerRFC854())
     {
         using (var client = new Client(server.IPAddress.ToString(), server.Port, new System.Threading.CancellationToken()))
         {
             client.IsConnected.Should().Be(true);
             client.TryLogin("username", "password", timeoutMs, linefeed: "\r\n").Should().Be(true);
         }
     }
 }
コード例 #4
0
ファイル: WithClient.cs プロジェクト: mwsoverdick/Telnet
 public void ShouldRespondWithWan2InfoCrLf()
 {
     using (var server = new TelnetServerRFC854())
     {
         using (Client client = new Client(server.IPAddress.ToString(), server.Port))
         {
             Assert.AreEqual(client.IsConnected, true);
             Assert.AreEqual(client.TryLogin("username", "password", timeoutMs, linefeed: "\r\n"), true);
             client.WriteLine("show statistic wan2", "\r\n");
             string s = client.TerminatedRead(">", TimeSpan.FromMilliseconds(timeoutMs));
             Assert.IsTrue(s.Contains(">"));
             Assert.IsTrue(s.Contains("WAN2"));
         }
     }
 }
コード例 #5
0
ファイル: WithClient.cs プロジェクト: Tryweirder/Telnet-1
 public void ShouldRespondWithWan2InfoCrLf()
 {
     using (var server = new TelnetServerRFC854())
     {
         using (var client = new Client(server.IPAddress.ToString(), server.Port, new System.Threading.CancellationToken()))
         {
             client.IsConnected.Should().Be(true);
             (client.TryLogin("username", "password", timeoutMs, linefeed: "\r\n")).Should().Be(true);
             client.WriteLine("show statistic wan2", linefeed: "\r\n");
             var s = client.TerminatedRead(">", TimeSpan.FromMilliseconds(timeoutMs));
             s.Should().Contain(">");
             s.Should().Contain("WAN2");
         }
     }
 }
コード例 #6
0
ファイル: WithClient.cs プロジェクト: mwsoverdick/Telnet
        public async Task ShouldRespondWithWan2InfoCrLf()
        {
            using (var server = new TelnetServerRFC854())
            {
                using (Client client = new Client(server.IPAddress.ToString(), server.Port, new System.Threading.CancellationToken()))
                {
                    client.IsConnected.Should().Be(true);
                    (await client.TryLoginAsync("username", "password", 1500, linefeed: "\r\n").ConfigureAwait(false)).Should().Be(true);
                    await client.WriteLine("show statistic wan2", linefeed : "\r\n").ConfigureAwait(false);

                    string s = await client.TerminatedReadAsync(">", TimeSpan.FromMilliseconds(timeoutMs)).ConfigureAwait(false);

                    s.Should().Contain(">");
                    s.Should().Contain("WAN2");
                }
            }
        }