SoapAttributesTests.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // System.Xml.XmlAttributesTests
  3. //
  4. // Author:
  5. // Gert Driesen
  6. //
  7. // (C) 2006 Novell
  8. //
  9. using System;
  10. using System.Xml.Serialization;
  11. using NUnit.Framework;
  12. using MonoTests.System.Xml.TestClasses;
  13. namespace MonoTests.System.XmlSerialization
  14. {
  15. [TestFixture]
  16. public class SoapAttributesTests
  17. {
  18. [Test]
  19. #if NET_2_0
  20. // in .NET 2.0, SoapDefaultValue should be null by default, but we need
  21. // more tests before making this change
  22. [Category ("NotDotNet")]
  23. #endif
  24. public void Defaults ()
  25. {
  26. SoapAttributes atts = new SoapAttributes ();
  27. Assert.IsNull (atts.SoapAttribute, "#1");
  28. Assert.IsNotNull (atts.SoapDefaultValue, "#2");
  29. Assert.AreEqual (DBNull.Value, atts.SoapDefaultValue, "#3");
  30. Assert.IsNull (atts.SoapElement, "#4");
  31. Assert.IsNull (atts.SoapEnum, "#5");
  32. Assert.AreEqual (false, atts.SoapIgnore, "#6");
  33. Assert.IsNull (atts.SoapType, "#7");
  34. }
  35. [Test]
  36. public void SoapType ()
  37. {
  38. SoapAttributes atts = new SoapAttributes (typeof (TestDefault));
  39. Assert.IsNotNull (atts.SoapType, "#1");
  40. Assert.AreEqual ("testDefault", atts.SoapType.TypeName, "#2");
  41. Assert.AreEqual ("urn:myNS", atts.SoapType.Namespace, "#3");
  42. }
  43. [Test]
  44. public void SoapDefaultValue ()
  45. {
  46. SoapAttributes atts = new SoapAttributes (typeof (TestDefault).GetMember("strDefault")[0]);
  47. Assert.IsNotNull (atts.SoapDefaultValue, "#1");
  48. Assert.AreEqual ("Default Value", atts.SoapDefaultValue, "#2");
  49. }
  50. [Test]
  51. public void SoapEnum ()
  52. {
  53. SoapAttributes atts = new SoapAttributes (typeof (FlagEnum_Encoded).GetMember("e1")[0]);
  54. Assert.IsNotNull (atts.SoapEnum, "#1");
  55. Assert.AreEqual ("one", atts.SoapEnum.Name, "#2");
  56. }
  57. }
  58. }