2
0

PrivateKeyAuthenticationMethodTest.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Renci.SshNet.Tests.Common;
  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. }
  43. }