PrivateKeyAuthenticationMethodTest.cs 979 B

123456789101112131415161718192021222324252627282930313233
  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. public void PrivateKey_Test_Pass_Null()
  14. {
  15. Assert.ThrowsException<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod(null, null));
  16. }
  17. [TestMethod]
  18. public void PrivateKey_Test_Pass_PrivateKey_Null()
  19. {
  20. Assert.ThrowsException<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod("username", null));
  21. }
  22. [TestMethod]
  23. public void PrivateKey_Test_Pass_Whitespace()
  24. {
  25. Assert.ThrowsException<ArgumentException>(() => new PrivateKeyAuthenticationMethod(string.Empty, null));
  26. }
  27. }
  28. }