Exemple #1
0
 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);
         }
     }
 }
Exemple #2
0
 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);
         }
     }
 }
Exemple #3
0
 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);
         }
     }
 }
Exemple #4
0
 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"));
         }
     }
 }
Exemple #5
0
 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");
         }
     }
 }
Exemple #6
0
        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");
                }
            }
        }