| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Renci.SshNet.Tests.Common;
- using System;
- using System.Xml;
- namespace Renci.SshNet.Tests.Classes
- {
- [TestClass]
- public class NetConfClientTest : TestBase
- {
- private Random _random;
- [TestInitialize]
- public void SetUp()
- {
- _random = new Random();
- }
- [TestMethod]
- public void OperationTimeout_Default()
- {
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo);
- var actual = target.OperationTimeout;
- Assert.AreEqual(TimeSpan.FromMilliseconds(-1), actual);
- }
- [TestMethod]
- public void OperationTimeout_InsideLimits()
- {
- var operationTimeout = TimeSpan.FromMilliseconds(_random.Next(0, int.MaxValue - 1));
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo)
- {
- OperationTimeout = operationTimeout
- };
- var actual = target.OperationTimeout;
- Assert.AreEqual(operationTimeout, actual);
- }
- [TestMethod]
- public void OperationTimeout_LowerLimit()
- {
- var operationTimeout = TimeSpan.FromMilliseconds(-1);
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo)
- {
- OperationTimeout = operationTimeout
- };
- var actual = target.OperationTimeout;
- Assert.AreEqual(operationTimeout, actual);
- }
- [TestMethod]
- public void OperationTimeout_UpperLimit()
- {
- var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue);
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo)
- {
- OperationTimeout = operationTimeout
- };
- var actual = target.OperationTimeout;
- Assert.AreEqual(operationTimeout, actual);
- }
- [TestMethod]
- public void OperationTimeout_LessThanLowerLimit()
- {
- var operationTimeout = TimeSpan.FromMilliseconds(-2);
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo);
- try
- {
- target.OperationTimeout = operationTimeout;
- }
- catch (ArgumentOutOfRangeException ex)
- {
- Assert.IsNull(ex.InnerException);
- ArgumentExceptionAssert.MessageEquals("The timeout must represent a value between -1 and Int32.MaxValue, inclusive.", ex);
- Assert.AreEqual("value", ex.ParamName);
- }
- }
- [TestMethod]
- public void OperationTimeout_GreaterThanLowerLimit()
- {
- var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue).Add(TimeSpan.FromMilliseconds(1));
- var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
- var target = new NetConfClient(connectionInfo);
- try
- {
- target.OperationTimeout = operationTimeout;
- }
- catch (ArgumentOutOfRangeException ex)
- {
- Assert.IsNull(ex.InnerException);
- ArgumentExceptionAssert.MessageEquals("The timeout must represent a value between -1 and Int32.MaxValue, inclusive.", ex);
- Assert.AreEqual("value", ex.ParamName);
- }
- }
- /// <summary>
- ///A test for NetConfClient Constructor
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void NetConfClientConstructorTest()
- {
- string host = string.Empty; // TODO: Initialize to an appropriate value
- string username = string.Empty; // TODO: Initialize to an appropriate value
- PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(host, username, keyFiles);
- Assert.Inconclusive("TODO: Implement code to verify target");
- }
- /// <summary>
- ///A test for NetConfClient Constructor
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void NetConfClientConstructorTest1()
- {
- string host = string.Empty; // TODO: Initialize to an appropriate value
- int port = 0; // TODO: Initialize to an appropriate value
- string username = string.Empty; // TODO: Initialize to an appropriate value
- PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(host, port, username, keyFiles);
- Assert.Inconclusive("TODO: Implement code to verify target");
- }
- /// <summary>
- ///A test for NetConfClient Constructor
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void NetConfClientConstructorTest2()
- {
- string host = string.Empty; // TODO: Initialize to an appropriate value
- string username = string.Empty; // TODO: Initialize to an appropriate value
- string password = string.Empty; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(host, username, password);
- Assert.Inconclusive("TODO: Implement code to verify target");
- }
- /// <summary>
- ///A test for NetConfClient Constructor
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void NetConfClientConstructorTest3()
- {
- string host = string.Empty; // TODO: Initialize to an appropriate value
- int port = 0; // TODO: Initialize to an appropriate value
- string username = string.Empty; // TODO: Initialize to an appropriate value
- string password = string.Empty; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(host, port, username, password);
- Assert.Inconclusive("TODO: Implement code to verify target");
- }
- /// <summary>
- ///A test for NetConfClient Constructor
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void NetConfClientConstructorTest4()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo);
- Assert.Inconclusive("TODO: Implement code to verify target");
- }
- /// <summary>
- ///A test for SendReceiveRpc
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void SendReceiveRpcTest()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- string xml = string.Empty; // TODO: Initialize to an appropriate value
- XmlDocument expected = null; // TODO: Initialize to an appropriate value
- XmlDocument actual;
- actual = target.SendReceiveRpc(xml);
- Assert.AreEqual(expected, actual);
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- /// <summary>
- ///A test for SendReceiveRpc
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void SendReceiveRpcTest1()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- XmlDocument rpc = null; // TODO: Initialize to an appropriate value
- XmlDocument expected = null; // TODO: Initialize to an appropriate value
- XmlDocument actual;
- actual = target.SendReceiveRpc(rpc);
- Assert.AreEqual(expected, actual);
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- /// <summary>
- ///A test for SendCloseRpc
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void SendCloseRpcTest()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- XmlDocument expected = null; // TODO: Initialize to an appropriate value
- XmlDocument actual;
- actual = target.SendCloseRpc();
- Assert.AreEqual(expected, actual);
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- /// <summary>
- ///A test for ServerCapabilities
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void ServerCapabilitiesTest()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- XmlDocument actual;
- actual = target.ServerCapabilities;
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- /// <summary>
- ///A test for ClientCapabilities
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void ClientCapabilitiesTest()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- XmlDocument actual;
- actual = target.ClientCapabilities;
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- /// <summary>
- ///A test for AutomaticMessageIdHandling
- ///</summary>
- [TestMethod]
- [Ignore] // placeholder for actual test
- public void AutomaticMessageIdHandlingTest()
- {
- ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
- NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
- bool expected = false; // TODO: Initialize to an appropriate value
- bool actual;
- target.AutomaticMessageIdHandling = expected;
- actual = target.AutomaticMessageIdHandling;
- Assert.AreEqual(expected, actual);
- Assert.Inconclusive("Verify the correctness of this test method.");
- }
- }
- }
|