2
0

PasswordAuthenticationMethodTest.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. public void Password_Test_Pass_Null_Username()
  14. {
  15. Assert.ThrowsException<ArgumentNullException>(() => new PasswordAuthenticationMethod(null, "valid"));
  16. }
  17. [TestMethod]
  18. public void Password_Test_Pass_Null_Password()
  19. {
  20. Assert.ThrowsException<ArgumentNullException>(() => new PasswordAuthenticationMethod("valid", (string)null));
  21. }
  22. [TestMethod]
  23. public void Password_Test_Pass_Valid_Username_And_Password()
  24. {
  25. new PasswordAuthenticationMethod("valid", "valid");
  26. }
  27. [TestMethod]
  28. public void Password_Test_Pass_Whitespace()
  29. {
  30. Assert.ThrowsException<ArgumentException>(() => new PasswordAuthenticationMethod(string.Empty, "valid"));
  31. }
  32. [TestMethod]
  33. public void Password_Test_Pass_Valid()
  34. {
  35. new PasswordAuthenticationMethod("valid", string.Empty);
  36. }
  37. }
  38. }