2
0

ExpectActionTest.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Globalization;
  3. using System.Text.RegularExpressions;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using Renci.SshNet.Tests.Common;
  6. namespace Renci.SshNet.Tests.Classes
  7. {
  8. [TestClass]
  9. public class ExpectActionTest : TestBase
  10. {
  11. [TestMethod()]
  12. public void Constructor_StringAndAction()
  13. {
  14. var expect = new Random().Next().ToString(CultureInfo.InvariantCulture);
  15. Action<string> action = Console.WriteLine;
  16. var target = new ExpectAction(expect, action);
  17. Assert.IsNotNull(target.Expect);
  18. Assert.AreEqual(expect, target.Expect.ToString());
  19. Assert.AreSame(action, target.Action);
  20. }
  21. [TestMethod()]
  22. public void Constructor_RegexAndAction()
  23. {
  24. var expect = new Regex("^.*");
  25. Action<string> action = Console.WriteLine;
  26. var target = new ExpectAction(expect, action);
  27. Assert.AreSame(expect, target.Expect);
  28. Assert.AreSame(action, target.Action);
  29. }
  30. }
  31. }