forked from ServiceStack/ServiceStack.OrmLite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrmLiteTestBase.cs
More file actions
36 lines (30 loc) · 1.1 KB
/
Copy pathOrmLiteTestBase.cs
File metadata and controls
36 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Configuration;
using System.Data;
using NUnit.Framework;
using ServiceStack.Logging;
namespace ServiceStack.OrmLite.SqlServerTests
{
public class OrmLiteTestBase
{
protected virtual string ConnectionString { get; set; }
public IDbConnection Db { get; set; }
[TestFixtureSetUp]
public virtual void TestFixtureSetUp()
{
LogManager.LogFactory = new ConsoleLogFactory();
OrmLiteConfig.DialectProvider = SqlServerDialect.Provider;
ConnectionString = ConfigurationManager.ConnectionStrings["testDb"].ConnectionString;
}
public void Log(string text)
{
Console.WriteLine(text);
}
public virtual IDbConnection OpenDbConnection(string connString = null, IOrmLiteDialectProvider dialectProvider = null)
{
dialectProvider = dialectProvider ?? OrmLiteConfig.DialectProvider;
connString = connString ?? ConnectionString;
return new OrmLiteConnectionFactory(connString, dialectProvider).OpenDbConnection();
}
}
}