2
0

ForwardedPortRemoteTest.cs 921 B

1234567891011121314151617181920212223242526272829303132333435
  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 for remote port forwarding
  8. /// </summary>
  9. [TestClass]
  10. public partial class ForwardedPortRemoteTest : TestBase
  11. {
  12. [TestMethod]
  13. public void Start_NotAddedToClient()
  14. {
  15. const int boundPort = 80;
  16. var host = string.Empty;
  17. const uint port = 22;
  18. var target = new ForwardedPortRemote(boundPort, host, port);
  19. try
  20. {
  21. target.Start();
  22. Assert.Fail();
  23. }
  24. catch (InvalidOperationException ex)
  25. {
  26. Assert.IsNull(ex.InnerException);
  27. Assert.AreEqual("Forwarded port is not added to a client.", ex.Message);
  28. }
  29. }
  30. }
  31. }