comparison UnitTests/DataProvider/SqlCe/CreateDatabase.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2 using System.IO;
3 using BLToolkit.Data;
4
5 using NUnit.Framework;
6
7 namespace UnitTests.CS
8 {
9 [TestFixture, Explicit, Category("DB setup")]
10 public class CreateDatabase
11 {
12 [Test]
13 public void Test()
14 {
15 const string path = @"..\..\..\..\Data\Create Scripts\SqlCe.sql";
16
17 using (DbManager db = new DbManager())
18 {
19 string cmd = string.Empty;
20 string term = "GO";
21
22 foreach (string s in File.ReadAllLines(path))
23 {
24 string line = s.TrimEnd();
25
26 if (!line.EndsWith(term))
27 {
28 cmd += line + Environment.NewLine;
29 continue;
30 }
31
32 line = line.Substring(0, line.Length - term.Length).Trim();
33
34 Console.WriteLine("Executing script:");
35 Console.WriteLine(cmd + line);
36
37 db
38 .SetCommand(cmd + line)
39 .ExecuteNonQuery()
40 ;
41
42 Console.WriteLine("Succeeded.");
43
44 cmd = string.Empty;
45 }
46 }
47 }
48 }
49 }