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:
10 // The above copyright notice and this permission notice shall be
11 // included in all copies or substantial portions of the Software.
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.
21 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
25 using NUnit.Framework;
28 using System.Collections.Specialized;
29 using System.ComponentModel;
30 using System.Xml.Serialization;
32 namespace MonoTests.System.ComponentModel {
35 public class LookupBindingPropertiesAttributeTest {
38 public void CtorTest ()
40 LookupBindingPropertiesAttribute a, b, c, d;
42 a = new LookupBindingPropertiesAttribute ();
43 Assert.IsNull (a.DataSource, "#A1");
44 Assert.IsNull (a.DisplayMember, "#A2");
45 Assert.IsNull (a.ValueMember, "#A3");
46 Assert.IsNull (a.LookupMember, "#A4");
48 b = new LookupBindingPropertiesAttribute ("aa", "bb", "cc", "dd");
49 Assert.AreSame ("aa", b.DataSource, "#B1");
50 Assert.AreSame ("bb", b.DisplayMember, "#B2");
51 Assert.AreSame ("cc", b.ValueMember, "#B3");
52 Assert.AreSame ("dd", b.LookupMember, "#B4");
54 c = new LookupBindingPropertiesAttribute ("aa", "bb", "cc", "dd");
56 Assert.AreEqual ("aa", c.DataSource, "#C1");
57 Assert.AreEqual ("bb", c.DisplayMember, "#C2");
58 Assert.AreEqual ("cc", c.ValueMember, "#C3");
59 Assert.AreEqual ("dd", c.LookupMember, "#C4");
61 Assert.IsTrue (b.Equals (c), "#Eq1");
62 Assert.AreEqual (b.GetHashCode (), c.GetHashCode (), "#Hash");
64 d = LookupBindingPropertiesAttribute.Default;
65 Assert.IsNull (d.DataSource, "#D1");
66 Assert.IsNull (d.DisplayMember, "#D2");
67 Assert.IsNull (d.ValueMember, "#D3");
68 Assert.IsNull (d.LookupMember, "#D4");
70 Assert.IsTrue (d.Equals (a), "#Eq2");
71 Assert.IsFalse (a.Equals (b), "#Eq3");