AddressHeaderTest.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Runtime.Serialization;
  5. using System.ServiceModel;
  6. using System.ServiceModel.Channels;
  7. using System.Text;
  8. using System.Xml;
  9. using System.Xml.Schema;
  10. using NUnit.Framework;
  11. namespace MonoTests.System.ServiceModel.Channels
  12. {
  13. [TestFixture]
  14. public class AddressHeaderTest
  15. {
  16. [Test]
  17. public void WriteAddressHeaderTest ()
  18. {
  19. AddressHeader h = AddressHeader.CreateAddressHeader (1);
  20. StringWriter sw = new StringWriter ();
  21. XmlWriterSettings s = new XmlWriterSettings ();
  22. s.OmitXmlDeclaration = true;
  23. XmlWriter w = XmlWriter.Create (sw, s);
  24. h.WriteAddressHeader (w);
  25. w.Close ();
  26. Assert.AreEqual (
  27. @"<int xmlns=""http://schemas.microsoft.com/2003/10/Serialization/"">1</int>",
  28. sw.ToString ());
  29. }
  30. [Test]
  31. public void CreateAddressHeader ()
  32. {
  33. AddressHeader h = AddressHeader.CreateAddressHeader ("foo", "urn:foo", null);
  34. }
  35. [Test]
  36. [Category ("NotDotNet")]
  37. // It should work, but MS implementation expects body to be
  38. // IComparable.
  39. public void EqualsTest ()
  40. {
  41. AddressHeader h = AddressHeader.CreateAddressHeader (
  42. "foo", "urn:foo", null);
  43. AddressHeader h2 = AddressHeader.CreateAddressHeader (
  44. "foo", "urn:foo", null);
  45. Assert.IsFalse (h.Equals (null), "#1"); // never throw nullref
  46. Assert.IsTrue (h.Equals (h2), "#2");
  47. }
  48. }
  49. }