[System] Don't send response on empty stream write. Fixes #47549
[mono.git] / mcs / class / System / Test / System.ComponentModel / LookupBindingPropertiesAttributeTest.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) 2007 Novell, Inc (http://www.novell.com)
22
23 #if !MOBILE
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 LookupBindingPropertiesAttributeTest {
36
37                 [Test]
38                 public void CtorTest ()
39                 {
40                         LookupBindingPropertiesAttribute a, b, c, d;
41
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");
47
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");
53
54                         c = new LookupBindingPropertiesAttribute ("aa", "bb", "cc", "dd");
55
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");
60
61                         Assert.IsTrue (b.Equals (c), "#Eq1");
62                         Assert.AreEqual (b.GetHashCode (), c.GetHashCode (), "#Hash");
63
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");
69
70                         Assert.IsTrue (d.Equals (a), "#Eq2");
71                         Assert.IsFalse (a.Equals (b), "#Eq3");
72                 }
73         }
74
75 }
76
77 #endif