PortForwardEventArgsTest.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Renci.SshNet.Common;
  3. using Renci.SshNet.Tests.Common;
  4. using System;
  5. using System.Net;
  6. namespace Renci.SshNet.Tests.Classes.Common
  7. {
  8. /// <summary>
  9. /// Provides data for <see cref="Renci.SshNet.ForwardedPort.RequestReceived"/> event.
  10. /// </summary>
  11. [TestClass]
  12. public class PortForwardEventArgsTest : TestBase
  13. {
  14. [TestMethod]
  15. [Description("Test passing null to constructor of PortForwardEventArgs.")]
  16. [ExpectedException(typeof(ArgumentNullException))]
  17. public void Test_PortForwardEventArgs_Host_Null()
  18. {
  19. var args = new PortForwardEventArgs(null, 80);
  20. }
  21. [TestMethod]
  22. [Description("Test passing an invalid port to constructor of PortForwardEventArgs.")]
  23. [ExpectedException(typeof(ArgumentOutOfRangeException))]
  24. public void Test_PortForwardEventArgs_Port_Invalid()
  25. {
  26. var args = new PortForwardEventArgs("string", IPEndPoint.MaxPort + 1);
  27. }
  28. }
  29. }