NoneAuthenticationMethodTest.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Globalization;
  3. using Microsoft.VisualStudio.TestTools.UnitTesting;
  4. using Renci.SshNet.Tests.Common;
  5. namespace Renci.SshNet.Tests.Classes
  6. {
  7. /// <summary>
  8. /// Provides functionality for "none" authentication method
  9. /// </summary>
  10. [TestClass]
  11. public class NoneAuthenticationMethodTest : TestBase
  12. {
  13. [TestMethod]
  14. public void None_Test_Pass_Null()
  15. {
  16. Assert.ThrowsException<ArgumentNullException>(() => new NoneAuthenticationMethod(null));
  17. }
  18. [TestMethod]
  19. public void None_Test_Pass_Whitespace()
  20. {
  21. Assert.ThrowsException<ArgumentException>(() => new NoneAuthenticationMethod(string.Empty));
  22. }
  23. [TestMethod]
  24. public void Name()
  25. {
  26. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  27. var target = new NoneAuthenticationMethod(username);
  28. Assert.AreEqual("none", target.Name);
  29. }
  30. [TestMethod]
  31. public void Username()
  32. {
  33. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  34. var target = new NoneAuthenticationMethod(username);
  35. Assert.AreSame(username, target.Username);
  36. }
  37. }
  38. }