* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Data / Test / System.Data.Tests.Mainsoft / System.Data / DataColumnCollection / DataColumnCollection_Contains_S.cs
1 // Authors:
2 //   Rafael Mizrahi   <rafim@mainsoft.com>
3 //   Erez Lotan       <erezl@mainsoft.com>
4 //   Oren Gurfinkel   <oreng@mainsoft.com>
5 //   Ofer Borstein
6 // 
7 // Copyright (c) 2004 Mainsoft Co.
8 // 
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using NUnit.Framework;
30 using System;
31 using System.Data;
32
33 using GHTUtils;
34 using GHTUtils.Base;
35
36 namespace tests.system_data_dll.System_Data
37 {
38 [TestFixture] public class DataColumnCollection_Contains_S : GHTBase
39 {
40         [Test] public void Main()
41         {
42                 DataColumnCollection_Contains_S tc = new DataColumnCollection_Contains_S();
43                 Exception exp = null;
44                 try
45                 {
46                         tc.BeginTest("DataColumnCollection_Contains_S");
47                         tc.run();
48                 }
49                 catch(Exception ex)
50                 {
51                         exp = ex;
52                 }
53                 finally
54                 {
55                         tc.EndTest(exp);
56                 }
57                 
58         }
59
60         //Activate This Construntor to log All To Standard output
61         //public TestClass():base(true){}
62
63         //Activate this constructor to log Failures to a log file
64         //public TestClass(System.IO.TextWriter tw):base(tw, false){}
65
66
67         //Activate this constructor to log All to a log file
68         //public TestClass(System.IO.TextWriter tw):base(tw, true){}
69
70         //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES
71
72         public void run()
73         {
74                 Exception exp = null;
75                 try
76                 {
77                         BeginCase("DataColumnCollection_Contains_S");
78                         DataColumnCollection_Contains_S1();
79                 } 
80                 catch(Exception ex)
81                 {
82                         exp = ex;
83                 }
84                 finally
85                 {
86                         EndCase(exp);
87                         exp = null;
88                 }
89         }
90
91         private void DataColumnCollection_Contains_S1()
92         {
93                 DataTable dt = DataProvider.CreateParentDataTable();
94                 Compare(dt.Columns.Contains("ParentId"),true);
95                 Compare(dt.Columns.Contains("String1"),true);
96                 Compare(dt.Columns.Contains("ParentBool"),true);
97
98                 Compare(dt.Columns.Contains("ParentId1"),false);
99                 dt.Columns.Remove("ParentId");
100                 Compare(dt.Columns.Contains("ParentId"),false);
101
102                 dt.Columns["String1"].ColumnName = "Temp1";
103
104                 Compare(dt.Columns.Contains("String1"),false);
105                 Compare(dt.Columns.Contains("Temp1"),true);
106
107         }
108         private void DataColumnCollection_Contains_S2()
109         {
110                 DataTable dt = DataProvider.CreateParentDataTable();
111                 Compare(dt.Columns.Contains(null),false);
112
113                 
114         }
115 }
116 }