2
0

PasswordAuthenticationMethodTest.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 password authentication.
  8. /// </summary>
  9. [TestClass]
  10. public partial class PasswordAuthenticationMethodTest : TestBase
  11. {
  12. [TestMethod]
  13. [TestCategory("AuthenticationMethod")]
  14. [Owner("Kenneth_aa")]
  15. [Description("PasswordAuthenticationMethod: Pass null as username, \"valid\" as password.")]
  16. [ExpectedException(typeof(ArgumentException))]
  17. public void Password_Test_Pass_Null_Username()
  18. {
  19. new PasswordAuthenticationMethod(null, "valid");
  20. }
  21. [TestMethod]
  22. [TestCategory("AuthenticationMethod")]
  23. [Owner("Kenneth_aa")]
  24. [Description("PasswordAuthenticationMethod: Pass \"valid\" as username, null as password.")]
  25. [ExpectedException(typeof(ArgumentNullException))]
  26. public void Password_Test_Pass_Null_Password()
  27. {
  28. new PasswordAuthenticationMethod("valid", (string)null);
  29. }
  30. [TestMethod]
  31. [TestCategory("AuthenticationMethod")]
  32. [Owner("Kenneth_aa")]
  33. [Description("PasswordAuthenticationMethod: Pass \"valid\" as username, \"valid\" as password.")]
  34. public void Password_Test_Pass_Valid_Username_And_Password()
  35. {
  36. new PasswordAuthenticationMethod("valid", "valid");
  37. }
  38. [TestMethod]
  39. [TestCategory("AuthenticationMethod")]
  40. [Owner("Kenneth_aa")]
  41. [Description("PasswordAuthenticationMethod: Pass String.Empty as username, \"valid\" as password.")]
  42. [ExpectedException(typeof(ArgumentException))]
  43. public void Password_Test_Pass_Whitespace()
  44. {
  45. new PasswordAuthenticationMethod(string.Empty, "valid");
  46. }
  47. [TestMethod]
  48. [TestCategory("AuthenticationMethod")]
  49. [Owner("Kenneth_aa")]
  50. [Description("PasswordAuthenticationMethod: Pass \"valid\" as username, String.Empty as password.")]
  51. public void Password_Test_Pass_Valid()
  52. {
  53. new PasswordAuthenticationMethod("valid", string.Empty);
  54. }
  55. }
  56. }