NoneAuthenticationMethodTest.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. [ExpectedException(typeof(ArgumentNullException))]
  15. public void None_Test_Pass_Null()
  16. {
  17. new NoneAuthenticationMethod(null);
  18. }
  19. [TestMethod]
  20. [ExpectedException(typeof(ArgumentException))]
  21. public void None_Test_Pass_Whitespace()
  22. {
  23. new NoneAuthenticationMethod(string.Empty);
  24. }
  25. [TestMethod]
  26. public void Name()
  27. {
  28. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  29. var target = new NoneAuthenticationMethod(username);
  30. Assert.AreEqual("none", target.Name);
  31. }
  32. [TestMethod]
  33. public void Username()
  34. {
  35. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  36. var target = new NoneAuthenticationMethod(username);
  37. Assert.AreSame(username, target.Username);
  38. }
  39. }
  40. }