PrivateKeyAuthenticationMethodTest.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Renci.SshNet.Tests.Common;
  3. using System;
  4. namespace Renci.SshNet.Tests.Classes
  5. {
  6. /// <summary>
  7. /// Provides functionality to perform private key authentication.
  8. /// </summary>
  9. [TestClass]
  10. public class PrivateKeyAuthenticationMethodTest : TestBase
  11. {
  12. [TestMethod]
  13. [TestCategory("AuthenticationMethod")]
  14. [TestCategory("PrivateKeyAuthenticationMethod")]
  15. [Owner("Kenneth_aa")]
  16. [Description("PrivateKeyAuthenticationMethod: Pass null as username, null as password.")]
  17. [ExpectedException(typeof(ArgumentException))]
  18. public void PrivateKey_Test_Pass_Null()
  19. {
  20. new PrivateKeyAuthenticationMethod(null, null);
  21. }
  22. [TestMethod]
  23. [TestCategory("AuthenticationMethod")]
  24. [TestCategory("PrivateKeyAuthenticationMethod")]
  25. [Owner("olegkap")]
  26. [Description("PrivateKeyAuthenticationMethod: Pass valid username, null as password.")]
  27. [ExpectedException(typeof(ArgumentNullException))]
  28. public void PrivateKey_Test_Pass_PrivateKey_Null()
  29. {
  30. new PrivateKeyAuthenticationMethod("username", null);
  31. }
  32. [TestMethod]
  33. [TestCategory("AuthenticationMethod")]
  34. [TestCategory("PrivateKeyAuthenticationMethod")]
  35. [Owner("Kenneth_aa")]
  36. [Description("PrivateKeyAuthenticationMethod: Pass String.Empty as username, null as password.")]
  37. [ExpectedException(typeof(ArgumentException))]
  38. public void PrivateKey_Test_Pass_Whitespace()
  39. {
  40. new PrivateKeyAuthenticationMethod(string.Empty, null);
  41. }
  42. /// <summary>
  43. ///A test for Name
  44. ///</summary>
  45. [TestMethod()]
  46. public void NameTest()
  47. {
  48. string username = string.Empty; // TODO: Initialize to an appropriate value
  49. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  50. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  51. string actual;
  52. actual = target.Name;
  53. Assert.Inconclusive("Verify the correctness of this test method.");
  54. }
  55. /// <summary>
  56. ///A test for Dispose
  57. ///</summary>
  58. [TestMethod()]
  59. public void DisposeTest()
  60. {
  61. string username = string.Empty; // TODO: Initialize to an appropriate value
  62. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  63. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  64. target.Dispose();
  65. Assert.Inconclusive("A method that does not return a value cannot be verified.");
  66. }
  67. /// <summary>
  68. ///A test for Authenticate
  69. ///</summary>
  70. [TestMethod()]
  71. public void AuthenticateTest()
  72. {
  73. string username = string.Empty; // TODO: Initialize to an appropriate value
  74. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  75. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  76. Session session = null; // TODO: Initialize to an appropriate value
  77. AuthenticationResult expected = new AuthenticationResult(); // TODO: Initialize to an appropriate value
  78. AuthenticationResult actual;
  79. actual = target.Authenticate(session);
  80. Assert.AreEqual(expected, actual);
  81. Assert.Inconclusive("Verify the correctness of this test method.");
  82. }
  83. /// <summary>
  84. ///A test for PrivateKeyAuthenticationMethod Constructor
  85. ///</summary>
  86. [TestMethod()]
  87. public void PrivateKeyAuthenticationMethodConstructorTest()
  88. {
  89. string username = string.Empty; // TODO: Initialize to an appropriate value
  90. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  91. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles);
  92. Assert.Inconclusive("TODO: Implement code to verify target");
  93. }
  94. }
  95. }