2009-06-12 Bill Holmes <billholmes54@gmail.com>
[mono.git] / mcs / class / System.Data.Linq / src / DbLinq.Sqlite / Test / TestBase.cs
1 #region MIT license\r
2 // \r
3 // MIT license\r
4 //\r
5 // Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne\r
6 // Copyright (c) 2009 Novell, Inc.\r
7 // \r
8 // Permission is hereby granted, free of charge, to any person obtaining a copy\r
9 // of this software and associated documentation files (the "Software"), to deal\r
10 // in the Software without restriction, including without limitation the rights\r
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
12 // copies of the Software, and to permit persons to whom the Software is\r
13 // furnished to do so, subject to the following conditions:\r
14 // \r
15 // The above copyright notice and this permission notice shall be included in\r
16 // all copies or substantial portions of the Software.\r
17 // \r
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
24 // THE SOFTWARE.\r
25 // \r
26 #endregion\r
27 \r
28 using System;\r
29 using System.Data;\r
30 using System.Data.SQLite;\r
31 using System.IO;\r
32 \r
33 namespace Test_NUnit\r
34 {\r
35     public abstract partial class TestBase\r
36     {\r
37         static bool doRecreate = true;\r
38         public const StringComparison stringComparisonType = StringComparison.InvariantCulture;\r
39 \r
40         static partial void CheckRecreateSqlite ()\r
41         {\r
42             if (doRecreate) {\r
43                 File.Copy ("../src/Northwind.db3", "Northwind.db3", true);\r
44                 doRecreate = false;\r
45             }\r
46         }\r
47 \r
48         public static IDbCommand CreateCommand (string sql, IDbConnection conn)\r
49         {\r
50             return new SQLiteCommand(sql, (SQLiteConnection) conn);\r
51         }\r
52 \r
53         public static IDbConnection CreateConnection (string connectionString)\r
54         {\r
55             return new SQLiteConnection(connectionString);\r
56         }\r
57 \r
58         public DbLinq.Vendor.IVendor CreateVendor()\r
59         {\r
60             return new DbLinq.Sqlite.SqliteVendor();\r
61         }\r
62     }\r
63 }\r