ComplexBindingPropertiesAttributeTest.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // Permission is hereby granted, free of charge, to any person obtaining
  3. // a copy of this software and associated documentation files (the
  4. // "Software"), to deal in the Software without restriction, including
  5. // without limitation the rights to use, copy, modify, merge, publish,
  6. // distribute, sublicense, and/or sell copies of the Software, and to
  7. // permit persons to whom the Software is furnished to do so, subject to
  8. // the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be
  11. // included in all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  17. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  18. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  19. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. //
  21. // Copyright (C) 2006 Novell, Inc (http://www.novell.com)
  22. #if NET_2_0
  23. using NUnit.Framework;
  24. using System;
  25. using System.IO;
  26. using System.Collections.Specialized;
  27. using System.ComponentModel;
  28. using System.Xml.Serialization;
  29. namespace MonoTests.System.ComponentModel {
  30. [TestFixture]
  31. public class ComplexBindingPropertiesAttributeTest {
  32. [Test]
  33. public void CtorTest ()
  34. {
  35. ComplexBindingPropertiesAttribute a;
  36. a = new ComplexBindingPropertiesAttribute ("source", "member");
  37. Assert.AreEqual ("source", a.DataSource, "1");
  38. Assert.AreEqual ("member", a.DataMember, "2");
  39. a = new ComplexBindingPropertiesAttribute ("source");
  40. Assert.AreEqual ("source", a.DataSource, "3");
  41. Assert.AreEqual (null, a.DataMember, "4");
  42. a = new ComplexBindingPropertiesAttribute ();
  43. Assert.AreEqual (null, a.DataSource, "5");
  44. Assert.AreEqual (null, a.DataMember, "6");
  45. }
  46. [Test]
  47. public void EqualsTest ()
  48. {
  49. ComplexBindingPropertiesAttribute a;
  50. a = new ComplexBindingPropertiesAttribute ("source", "member");
  51. Assert.IsFalse (a.Equals (null), "1");
  52. Assert.IsFalse (a.Equals (new ComplexBindingPropertiesAttribute ("member", "source")), "2");
  53. Assert.IsTrue (a.Equals (new ComplexBindingPropertiesAttribute ("source", "member")), "3");
  54. }
  55. [Test]
  56. public void GetHashCodeTest ()
  57. {
  58. ComplexBindingPropertiesAttribute a;
  59. a = new ComplexBindingPropertiesAttribute ("source", "member");
  60. Assert.IsFalse (0 == a.GetHashCode (), "1");
  61. a = new ComplexBindingPropertiesAttribute ("source");
  62. Assert.IsFalse (0 == a.GetHashCode (), "2");
  63. a = new ComplexBindingPropertiesAttribute ();
  64. Assert.IsFalse (0 == a.GetHashCode (), "3");
  65. }
  66. [Test]
  67. public void DefaultTest ()
  68. {
  69. Assert.AreEqual (ComplexBindingPropertiesAttribute.Default, new ComplexBindingPropertiesAttribute (), "1");
  70. }
  71. }
  72. }
  73. #endif