LookupBindingPropertiesAttributeTest.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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) 2007 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 LookupBindingPropertiesAttributeTest {
  32. [Test]
  33. public void CtorTest ()
  34. {
  35. LookupBindingPropertiesAttribute a, b, c, d;
  36. a = new LookupBindingPropertiesAttribute ();
  37. Assert.IsNull (a.DataSource, "#A1");
  38. Assert.IsNull (a.DisplayMember, "#A2");
  39. Assert.IsNull (a.ValueMember, "#A3");
  40. Assert.IsNull (a.LookupMember, "#A4");
  41. b = new LookupBindingPropertiesAttribute ("aa", "bb", "cc", "dd");
  42. Assert.AreSame ("aa", b.DataSource, "#B1");
  43. Assert.AreSame ("bb", b.DisplayMember, "#B2");
  44. Assert.AreSame ("cc", b.ValueMember, "#B3");
  45. Assert.AreSame ("dd", b.LookupMember, "#B4");
  46. c = new LookupBindingPropertiesAttribute ("aa", "bb", "cc", "dd");
  47. Assert.AreEqual ("aa", c.DataSource, "#C1");
  48. Assert.AreEqual ("bb", c.DisplayMember, "#C2");
  49. Assert.AreEqual ("cc", c.ValueMember, "#C3");
  50. Assert.AreEqual ("dd", c.LookupMember, "#C4");
  51. Assert.IsTrue (b.Equals (c), "#Eq1");
  52. Assert.AreEqual (b.GetHashCode (), c.GetHashCode (), "#Hash");
  53. d = LookupBindingPropertiesAttribute.Default;
  54. Assert.IsNull (d.DataSource, "#D1");
  55. Assert.IsNull (d.DisplayMember, "#D2");
  56. Assert.IsNull (d.ValueMember, "#D3");
  57. Assert.IsNull (d.LookupMember, "#D4");
  58. Assert.IsTrue (d.Equals (a), "#Eq2");
  59. Assert.IsFalse (a.Equals (b), "#Eq3");
  60. }
  61. }
  62. }
  63. #endif