Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit a37b5a0

Browse files
committed
Fix Oracle.Test build errors, move common base code to TestHelpers
1 parent d9bc444 commit a37b5a0

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

src/ServiceStack.OrmLite.Oracle.Tests/OrmLiteTestBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public void Log(string text)
4646
Console.WriteLine(text);
4747
}
4848

49-
public IDbConnection OpenDbConnection(string connString = null)
49+
public Dialect Dialect = Dialect.Oracle;
50+
51+
public virtual IDbConnection OpenDbConnection(string connString = null)
5052
{
5153
connString = connString ?? ConnectionString;
5254
return connString.OpenDbConnection();

src/ServiceStack.OrmLite.Oracle.Tests/ServiceStack.OrmLite.Oracle.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@
294294
<Compile Include="..\..\tests\ServiceStack.OrmLite.Tests\SqlFormatTests.cs">
295295
<Link>SqlFormatTests.cs</Link>
296296
</Compile>
297+
<Compile Include="..\..\tests\ServiceStack.OrmLite.Tests\TestHelpers.cs">
298+
<Link>TestHelpers.cs</Link>
299+
</Compile>
297300
<Compile Include="..\..\tests\ServiceStack.OrmLite.Tests\TypeDescriptorMetadataTests.cs">
298301
<Link>TypeDescriptorMetadataTests.cs</Link>
299302
</Compile>

tests/ServiceStack.OrmLite.Tests/LocalizationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void Can_query_using_float_in_alernate_culuture()
4646
db.Insert(new Point { Width = 4, Height = 1.123f, Top = 3.456d, Left = 2.345m});
4747
db.PrintLastSql();
4848

49-
var sql = OrmLiteConfig.DialectProvider == PostgreSqlDialect.Provider
49+
var sql = Dialect == Dialect.PostgreSql
5050
? "round(cast(Height as numeric),3)={0}"
5151
: "round(Height,3)={0}";
5252
var points = db.SelectFmt<Point>(sql, 1.123);

tests/ServiceStack.OrmLite.Tests/OrmLiteTestBase.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ public static IDbConnection OpenDbConnection()
3030
}
3131
}
3232

33-
public enum Dialect
34-
{
35-
Sqlite,
36-
SqlServer,
37-
PostgreSql,
38-
MySql,
39-
SqlServerMdf,
40-
Oracle,
41-
}
42-
4333
public class OrmLiteTestBase
4434
{
4535
protected virtual string ConnectionString { get; set; }
@@ -135,12 +125,4 @@ protected void SuppressIfOracle(string reason, params object[] args)
135125
// Not Oracle if this base class used
136126
}
137127
}
138-
139-
public static class TestHelpers
140-
{
141-
public static string NormalizeSql(this string sql)
142-
{
143-
return sql.ToLower().Replace("\"", "").Replace("`", "").Replace("_","");
144-
}
145-
}
146128
}

tests/ServiceStack.OrmLite.Tests/ServiceStack.OrmLite.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<Compile Include="OrmLiteFiltersTests.cs" />
132132
<Compile Include="PerfTests.cs" />
133133
<Compile Include="StringSerializerTests.cs" />
134+
<Compile Include="TestHelpers.cs" />
134135
<Compile Include="TypeDescriptorMetadataTests.cs" />
135136
<Compile Include="Shared\ApiUtilExtensions.cs" />
136137
<Compile Include="EnumTests.cs" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace ServiceStack.OrmLite.Tests
2+
{
3+
public enum Dialect
4+
{
5+
Sqlite,
6+
SqlServer,
7+
PostgreSql,
8+
MySql,
9+
SqlServerMdf,
10+
Oracle,
11+
}
12+
13+
public static class TestHelpers
14+
{
15+
public static string NormalizeSql(this string sql)
16+
{
17+
return sql.ToLower().Replace("\"", "").Replace("`", "").Replace("_","");
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)