PrivateKeyAuthenticationMethodTest.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. [Ignore] // placeholder for actual test
  47. public void NameTest()
  48. {
  49. string username = string.Empty; // TODO: Initialize to an appropriate value
  50. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  51. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  52. string actual;
  53. actual = target.Name;
  54. Assert.Inconclusive("Verify the correctness of this test method.");
  55. }
  56. /// <summary>
  57. ///A test for Dispose
  58. ///</summary>
  59. [TestMethod]
  60. [Ignore] // placeholder for actual test
  61. public void DisposeTest()
  62. {
  63. string username = string.Empty; // TODO: Initialize to an appropriate value
  64. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  65. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  66. target.Dispose();
  67. Assert.Inconclusive("A method that does not return a value cannot be verified.");
  68. }
  69. /// <summary>
  70. ///A test for Authenticate
  71. ///</summary>
  72. [TestMethod]
  73. [Ignore] // placeholder for actual test
  74. public void AuthenticateTest()
  75. {
  76. string username = string.Empty; // TODO: Initialize to an appropriate value
  77. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  78. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
  79. Session session = null; // TODO: Initialize to an appropriate value
  80. AuthenticationResult expected = new AuthenticationResult(); // TODO: Initialize to an appropriate value
  81. AuthenticationResult actual;
  82. actual = target.Authenticate(session);
  83. Assert.AreEqual(expected, actual);
  84. Assert.Inconclusive("Verify the correctness of this test method.");
  85. }
  86. /// <summary>
  87. ///A test for PrivateKeyAuthenticationMethod Constructor
  88. ///</summary>
  89. [TestMethod]
  90. [Ignore] // placeholder for actual test
  91. public void PrivateKeyAuthenticationMethodConstructorTest()
  92. {
  93. string username = string.Empty; // TODO: Initialize to an appropriate value
  94. PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
  95. PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles);
  96. Assert.Inconclusive("TODO: Implement code to verify target");
  97. }
  98. }
  99. }