OperationContractTester.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Proxy.MonoTests.Features.Client;
  5. using NUnit.Framework;
  6. using System.ServiceModel;
  7. using MonoTests.Features.Contracts;
  8. using System.Threading;
  9. namespace MonoTests.Features.Serialization
  10. {
  11. [TestFixture]
  12. public class OperationContractTest : TestFixtureBase<OperationContractClient, OperationContractServer, MonoTests.Features.Contracts.IOperationContract>
  13. {
  14. [Test]
  15. [Category("NotWorking")]
  16. public void TestName () {
  17. Assert.AreEqual(Client.OrigMethod(),2,"Calling OrigMethod should actually call RenamedMethod");
  18. Assert.AreEqual(Client.RenamedMethod(),1,"Calling RenamedMethod should actually call OrigMethod");
  19. }
  20. [Test]
  21. [Category("NotWorking")]
  22. public void TestOneWay () {
  23. int sleepTime = 1 * 1000, failTime = 500; // Good times for inproc, no debugging.
  24. if (!Configuration.IsLocal) {
  25. sleepTime = 5 * 1000;
  26. failTime = 2 * 1000;
  27. }
  28. var sw = global::System.Diagnostics.Stopwatch.StartNew ();
  29. Client.Sleep (sleepTime);
  30. sw.Stop ();
  31. TimeSpan max = TimeSpan.FromMilliseconds(failTime);
  32. Assert.IsTrue (sw.Elapsed < max, "Sleep({0} milisec) must end in less than {1} seconds",sleepTime,failTime);
  33. if (sleepTime > (int) sw.ElapsedMilliseconds)
  34. Thread.Sleep (sleepTime - (int)sw.ElapsedMilliseconds); // wait for server thread to release itself
  35. }
  36. [Test]
  37. [Category ("NotWorking")]
  38. public void TestWsdl () {
  39. CheckWsdlImpl ();
  40. }
  41. }
  42. }