KeyboardInteractiveConnectionInfoTest.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Renci.SshNet.Common;
  3. using Renci.SshNet.Tests.Common;
  4. using Renci.SshNet.Tests.Properties;
  5. using System;
  6. namespace Renci.SshNet.Tests.Classes
  7. {
  8. /// <summary>
  9. /// Provides connection information when keyboard interactive authentication method is used
  10. /// </summary>
  11. [TestClass]
  12. public class KeyboardInteractiveConnectionInfoTest : TestBase
  13. {
  14. [TestMethod]
  15. [TestCategory("KeyboardInteractiveConnectionInfo")]
  16. public void Test_KeyboardInteractiveConnectionInfo()
  17. {
  18. var host = Resources.HOST;
  19. var username = Resources.USERNAME;
  20. var password = Resources.PASSWORD;
  21. #region Example KeyboardInteractiveConnectionInfo AuthenticationPrompt
  22. var connectionInfo = new KeyboardInteractiveConnectionInfo(host, username);
  23. connectionInfo.AuthenticationPrompt += delegate(object sender, AuthenticationPromptEventArgs e)
  24. {
  25. System.Console.WriteLine(e.Instruction);
  26. foreach (var prompt in e.Prompts)
  27. {
  28. Console.WriteLine(prompt.Request);
  29. prompt.Response = Console.ReadLine();
  30. }
  31. };
  32. using (var client = new SftpClient(connectionInfo))
  33. {
  34. client.Connect();
  35. // Do something here
  36. client.Disconnect();
  37. }
  38. #endregion
  39. Assert.AreEqual(connectionInfo.Host, Resources.HOST);
  40. Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
  41. }
  42. /// <summary>
  43. ///A test for Dispose
  44. ///</summary>
  45. [TestMethod()]
  46. public void DisposeTest()
  47. {
  48. string host = string.Empty; // TODO: Initialize to an appropriate value
  49. string username = string.Empty; // TODO: Initialize to an appropriate value
  50. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username); // TODO: Initialize to an appropriate value
  51. target.Dispose();
  52. Assert.Inconclusive("A method that does not return a value cannot be verified.");
  53. }
  54. /// <summary>
  55. ///A test for KeyboardInteractiveConnectionInfo Constructor
  56. ///</summary>
  57. [TestMethod()]
  58. public void KeyboardInteractiveConnectionInfoConstructorTest()
  59. {
  60. string host = string.Empty; // TODO: Initialize to an appropriate value
  61. int port = 0; // TODO: Initialize to an appropriate value
  62. string username = string.Empty; // TODO: Initialize to an appropriate value
  63. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  64. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  65. int proxyPort = 0; // TODO: Initialize to an appropriate value
  66. string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
  67. string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
  68. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword);
  69. Assert.Inconclusive("TODO: Implement code to verify target");
  70. }
  71. /// <summary>
  72. ///A test for KeyboardInteractiveConnectionInfo Constructor
  73. ///</summary>
  74. [TestMethod()]
  75. public void KeyboardInteractiveConnectionInfoConstructorTest1()
  76. {
  77. string host = string.Empty; // TODO: Initialize to an appropriate value
  78. string username = string.Empty; // TODO: Initialize to an appropriate value
  79. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  80. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  81. int proxyPort = 0; // TODO: Initialize to an appropriate value
  82. string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
  83. string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
  84. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword);
  85. Assert.Inconclusive("TODO: Implement code to verify target");
  86. }
  87. /// <summary>
  88. ///A test for KeyboardInteractiveConnectionInfo Constructor
  89. ///</summary>
  90. [TestMethod()]
  91. public void KeyboardInteractiveConnectionInfoConstructorTest2()
  92. {
  93. string host = string.Empty; // TODO: Initialize to an appropriate value
  94. string username = string.Empty; // TODO: Initialize to an appropriate value
  95. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  96. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  97. int proxyPort = 0; // TODO: Initialize to an appropriate value
  98. string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
  99. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername);
  100. Assert.Inconclusive("TODO: Implement code to verify target");
  101. }
  102. /// <summary>
  103. ///A test for KeyboardInteractiveConnectionInfo Constructor
  104. ///</summary>
  105. [TestMethod()]
  106. public void KeyboardInteractiveConnectionInfoConstructorTest3()
  107. {
  108. string host = string.Empty; // TODO: Initialize to an appropriate value
  109. string username = string.Empty; // TODO: Initialize to an appropriate value
  110. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  111. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  112. int proxyPort = 0; // TODO: Initialize to an appropriate value
  113. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username, proxyType, proxyHost, proxyPort);
  114. Assert.Inconclusive("TODO: Implement code to verify target");
  115. }
  116. /// <summary>
  117. ///A test for KeyboardInteractiveConnectionInfo Constructor
  118. ///</summary>
  119. [TestMethod()]
  120. public void KeyboardInteractiveConnectionInfoConstructorTest4()
  121. {
  122. string host = string.Empty; // TODO: Initialize to an appropriate value
  123. int port = 0; // TODO: Initialize to an appropriate value
  124. string username = string.Empty; // TODO: Initialize to an appropriate value
  125. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  126. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  127. int proxyPort = 0; // TODO: Initialize to an appropriate value
  128. string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
  129. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername);
  130. Assert.Inconclusive("TODO: Implement code to verify target");
  131. }
  132. /// <summary>
  133. ///A test for KeyboardInteractiveConnectionInfo Constructor
  134. ///</summary>
  135. [TestMethod()]
  136. public void KeyboardInteractiveConnectionInfoConstructorTest5()
  137. {
  138. string host = string.Empty; // TODO: Initialize to an appropriate value
  139. int port = 0; // TODO: Initialize to an appropriate value
  140. string username = string.Empty; // TODO: Initialize to an appropriate value
  141. ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
  142. string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
  143. int proxyPort = 0; // TODO: Initialize to an appropriate value
  144. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort);
  145. Assert.Inconclusive("TODO: Implement code to verify target");
  146. }
  147. /// <summary>
  148. ///A test for KeyboardInteractiveConnectionInfo Constructor
  149. ///</summary>
  150. [TestMethod()]
  151. public void KeyboardInteractiveConnectionInfoConstructorTest6()
  152. {
  153. string host = string.Empty; // TODO: Initialize to an appropriate value
  154. int port = 0; // TODO: Initialize to an appropriate value
  155. string username = string.Empty; // TODO: Initialize to an appropriate value
  156. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, port, username);
  157. Assert.Inconclusive("TODO: Implement code to verify target");
  158. }
  159. /// <summary>
  160. ///A test for KeyboardInteractiveConnectionInfo Constructor
  161. ///</summary>
  162. [TestMethod()]
  163. public void KeyboardInteractiveConnectionInfoConstructorTest7()
  164. {
  165. string host = string.Empty; // TODO: Initialize to an appropriate value
  166. string username = string.Empty; // TODO: Initialize to an appropriate value
  167. KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username);
  168. Assert.Inconclusive("TODO: Implement code to verify target");
  169. }
  170. }
  171. }