* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Data / Test / ProviderTests / System.Data.SqlClient.jvm / SqlParameter / SqlParameter_ctor_SO.cs
1 using System;\r
2 using System.Data;\r
3 using System.Data.SqlClient;\r
4 \r
5 using MonoTests.System.Data.Utils;\r
6 \r
7 using NUnit.Framework;\r
8 \r
9 namespace MonoTests.System.Data.SqlClient\r
10 {\r
11         [TestFixture]\r
12         public class SqlParameter_ctor_SO : GHTBase\r
13         {\r
14                 private Exception exp = null;\r
15 \r
16                 public static void Main()\r
17                 {\r
18                         SqlParameter_ctor_SO tc = new SqlParameter_ctor_SO();\r
19                         try\r
20                         {\r
21                                 tc.BeginTest("SqlParameter_ctor_SO");\r
22                                 tc.run();\r
23                         }\r
24                         catch(Exception ex)\r
25                         {\r
26                                 tc.exp = ex;\r
27                         }\r
28                         finally\r
29                         {\r
30                                 // Every Test must End with EndTest\r
31                                 tc.EndTest(tc.exp);\r
32                         }\r
33                 }\r
34 \r
35                 public void run()\r
36                 {\r
37                         CreateParamWithTypeBoolTrue();\r
38                         CreateParamWithTypeBoolFalse();\r
39                 }\r
40 \r
41                 [Test(Description="Create an SqlParameter with value of type bool (true)")]\r
42                 public void CreateParamWithTypeBoolTrue()\r
43                 {\r
44                         if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer) {\r
45                                 //All tests in this class are only for MSSQLServer.\r
46                                 Log(string.Format("All tests in this class are only for MSSQLServer and cannot be tested on {0}", ConnectedDataProvider.GetDbType()));\r
47                                 return;\r
48                         }\r
49                         exp = null;\r
50 \r
51                         try\r
52                         {\r
53                                 BeginCase("Create an SqlParameter with value of type bool (true)");\r
54                                 SqlParameter p = new SqlParameter("name", true);\r
55                                 Compare(p.Value.GetType(), typeof(bool));\r
56                                 Compare(p.DbType, DbType.Boolean);\r
57                                 Compare(p.SqlDbType, SqlDbType.Bit);\r
58                         } \r
59                         catch(Exception ex)\r
60                         {\r
61                                 exp = ex;\r
62                         }\r
63                         finally\r
64                         {\r
65                                 EndCase(exp);\r
66                                 exp = null;\r
67                         }\r
68                 }\r
69 \r
70                 [Test(Description="Create an SqlParameter with value of type bool (false)")]\r
71                 public void CreateParamWithTypeBoolFalse()\r
72                 {\r
73                         if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer) {\r
74                                 //All tests in this class are only for MSSQLServer.\r
75                                 Log(string.Format("All tests in this class are only for MSSQLServer and cannot be tested on {0}", ConnectedDataProvider.GetDbType()));\r
76                                 return;\r
77                         }\r
78                         exp = null;\r
79 \r
80                         try\r
81                         {\r
82                                 BeginCase("Create an SqlParameter with value of type bool (false)");\r
83                                 SqlParameter p = new SqlParameter("name", false);\r
84                                 Compare(p.Value.GetType(), typeof(bool));\r
85                                 Compare(p.DbType, DbType.Boolean);\r
86                                 Compare(p.SqlDbType, SqlDbType.Bit);\r
87                         } \r
88                         catch(Exception ex)\r
89                         {\r
90                                 exp = ex;\r
91                         }\r
92                         finally\r
93                         {\r
94                                 EndCase(exp);\r
95                                 exp = null;\r
96                         }\r
97                 }\r
98         }\r
99 }