FaultsTest.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. namespace MonoTests.Features.Serialization
  9. {
  10. [TestFixture]
  11. public class FaultsTest : TestFixtureBase<FaultsTesterContractClient, FaultsTester, MonoTests.Features.Contracts.IFaultsTesterContract>
  12. {
  13. [Test]
  14. public void TestFault ()
  15. {
  16. try {
  17. Client.FaultMethod ("heh");
  18. }
  19. catch (FaultException e) {
  20. return;
  21. }
  22. Assert.Fail ("No exception was thrown");
  23. }
  24. }
  25. [TestFixture]
  26. public class FaultsTestIncludeDetails : TestFixtureBase<FaultsTesterContractClientIncludeDetails, MonoTests.Features.Contracts.FaultsTesterIncludeDetails, MonoTests.Features.Contracts.IFaultsTesterContractIncludeDetails>
  27. {
  28. [Test]
  29. public void TestFault ()
  30. {
  31. try {
  32. Client.FaultMethod ("heh");
  33. }
  34. catch (FaultException<ExceptionDetail> e) {
  35. Assert.AreEqual ("heh", e.Message);
  36. return;
  37. }
  38. Assert.Fail ("No exception was thrown");
  39. }
  40. }
  41. }