NoneAuthenticationMethodTest.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Globalization;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Renci.SshNet.Tests.Common;
  4. using System;
  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. [TestCategory("AuthenticationMethod")]
  15. [Owner("Kenneth_aa")]
  16. [Description("NoneAuthenticationMethod: Pass null as username.")]
  17. [ExpectedException(typeof(ArgumentException))]
  18. public void None_Test_Pass_Null()
  19. {
  20. new NoneAuthenticationMethod(null);
  21. }
  22. [TestMethod]
  23. [TestCategory("AuthenticationMethod")]
  24. [Owner("Kenneth_aa")]
  25. [Description("NoneAuthenticationMethod: Pass String.Empty as username.")]
  26. [ExpectedException(typeof(ArgumentException))]
  27. public void None_Test_Pass_Whitespace()
  28. {
  29. new NoneAuthenticationMethod(string.Empty);
  30. }
  31. [TestMethod]
  32. public void Name()
  33. {
  34. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  35. var target = new NoneAuthenticationMethod(username);
  36. Assert.AreEqual("none", target.Name);
  37. }
  38. [TestMethod]
  39. public void Username()
  40. {
  41. var username = new Random().Next().ToString(CultureInfo.InvariantCulture);
  42. var target = new NoneAuthenticationMethod(username);
  43. Assert.AreSame(username, target.Username);
  44. }
  45. /// <summary>
  46. ///A test for Dispose
  47. ///</summary>
  48. [TestMethod]
  49. [Ignore] // placeholder for actual test
  50. public void DisposeTest()
  51. {
  52. string username = string.Empty; // TODO: Initialize to an appropriate value
  53. NoneAuthenticationMethod target = new NoneAuthenticationMethod(username); // TODO: Initialize to an appropriate value
  54. target.Dispose();
  55. Assert.Inconclusive("A method that does not return a value cannot be verified.");
  56. }
  57. /// <summary>
  58. ///A test for Authenticate
  59. ///</summary>
  60. [TestMethod]
  61. [Ignore] // placeholder for actual test
  62. public void AuthenticateTest()
  63. {
  64. string username = string.Empty; // TODO: Initialize to an appropriate value
  65. NoneAuthenticationMethod target = new NoneAuthenticationMethod(username); // TODO: Initialize to an appropriate value
  66. Session session = null; // TODO: Initialize to an appropriate value
  67. AuthenticationResult expected = new AuthenticationResult(); // TODO: Initialize to an appropriate value
  68. AuthenticationResult actual;
  69. actual = target.Authenticate(session);
  70. Assert.AreEqual(expected, actual);
  71. Assert.Inconclusive("Verify the correctness of this test method.");
  72. }
  73. /// <summary>
  74. ///A test for NoneAuthenticationMethod Constructor
  75. ///</summary>
  76. [TestMethod]
  77. [Ignore] // placeholder for actual test
  78. public void NoneAuthenticationMethodConstructorTest()
  79. {
  80. string username = string.Empty; // TODO: Initialize to an appropriate value
  81. NoneAuthenticationMethod target = new NoneAuthenticationMethod(username);
  82. Assert.Inconclusive("TODO: Implement code to verify target");
  83. }
  84. }
  85. }