OperationContractTester.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. DateTime start = DateTime.Now;
  29. Client.Sleep (sleepTime);
  30. DateTime end = DateTime.Now;
  31. TimeSpan diff = end.Subtract (start);
  32. TimeSpan max = TimeSpan.FromMilliseconds(failTime);
  33. Assert.IsTrue (diff < max, "Sleep({0} milisec) must end in less than {1} seconds",sleepTime,failTime);
  34. if (sleepTime > (int) diff.TotalMilliseconds)
  35. Thread.Sleep (sleepTime - (int)diff.TotalMilliseconds); // wait for server thread to release itself
  36. }
  37. [Test]
  38. [Category ("NotWorking")]
  39. public void TestWsdl () {
  40. CheckWsdlImpl ();
  41. }
  42. }
  43. }