Merge branch 'master' of github.com:mono/mono
[mono.git] / mcs / class / System / Test / System.ComponentModel / ComplexBindingPropertiesAttributeTest.cs
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
23 #if NET_2_0
24
25 using NUnit.Framework;
26 using System;
27 using System.IO;
28 using System.Collections.Specialized;
29 using System.ComponentModel;
30 using System.Xml.Serialization;
31
32 namespace MonoTests.System.ComponentModel {
33
34         [TestFixture]
35         public class ComplexBindingPropertiesAttributeTest {
36
37                 [Test]
38                 public void CtorTest ()
39                 {
40                         ComplexBindingPropertiesAttribute a;
41
42                         a = new ComplexBindingPropertiesAttribute ("source", "member");
43                         Assert.AreEqual ("source", a.DataSource, "1");
44                         Assert.AreEqual ("member", a.DataMember, "2");
45
46                         a = new ComplexBindingPropertiesAttribute ("source");
47                         Assert.AreEqual ("source", a.DataSource, "3");
48                         Assert.AreEqual (null, a.DataMember, "4");
49
50                         a = new ComplexBindingPropertiesAttribute ();
51                         Assert.AreEqual (null, a.DataSource, "5");
52                         Assert.AreEqual (null, a.DataMember, "6");
53                 }
54
55                 [Test]
56                 public void EqualsTest ()
57                 {
58                         ComplexBindingPropertiesAttribute a;
59
60                         a = new ComplexBindingPropertiesAttribute ("source", "member");
61                         Assert.IsFalse (a.Equals (null), "1");
62                         Assert.IsFalse (a.Equals (new ComplexBindingPropertiesAttribute ("member", "source")), "2");
63                         Assert.IsTrue (a.Equals (new ComplexBindingPropertiesAttribute ("source", "member")), "3");
64                 }
65
66                 [Test]
67                 public void GetHashCodeTest ()
68                 {
69                         ComplexBindingPropertiesAttribute a;
70
71                         a = new ComplexBindingPropertiesAttribute ("source", "member");
72                         Assert.IsFalse (0 == a.GetHashCode (), "1");
73
74                         a = new ComplexBindingPropertiesAttribute ("source");
75                         Assert.IsFalse (0 == a.GetHashCode (), "2");
76                 }
77
78                 [Test]
79                 public void DefaultTest ()
80                 {
81                         Assert.AreEqual (ComplexBindingPropertiesAttribute.Default, new ComplexBindingPropertiesAttribute (), "1");
82                 }
83         }
84
85 }
86
87 #endif