2
0

PasswordAuthenticationMethodTest.cs 1.3 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 password authentication.
  8. /// </summary>
  9. [TestClass]
  10. public partial class PasswordAuthenticationMethodTest : TestBase
  11. {
  12. [TestMethod]
  13. [ExpectedException(typeof(ArgumentNullException))]
  14. public void Password_Test_Pass_Null_Username()
  15. {
  16. new PasswordAuthenticationMethod(null, "valid");
  17. }
  18. [TestMethod]
  19. [ExpectedException(typeof(ArgumentNullException))]
  20. public void Password_Test_Pass_Null_Password()
  21. {
  22. new PasswordAuthenticationMethod("valid", (string)null);
  23. }
  24. [TestMethod]
  25. public void Password_Test_Pass_Valid_Username_And_Password()
  26. {
  27. new PasswordAuthenticationMethod("valid", "valid");
  28. }
  29. [TestMethod]
  30. [ExpectedException(typeof(ArgumentException))]
  31. public void Password_Test_Pass_Whitespace()
  32. {
  33. new PasswordAuthenticationMethod(string.Empty, "valid");
  34. }
  35. [TestMethod]
  36. public void Password_Test_Pass_Valid()
  37. {
  38. new PasswordAuthenticationMethod("valid", string.Empty);
  39. }
  40. }
  41. }