diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDatabaseTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDatabaseTests.cs
index a9ea2f0f..bd1078c9 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDatabaseTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDatabaseTests.cs
@@ -1,14 +1,46 @@
-using PetaPoco.Tests.Integration.Providers;
+using System.Reflection;
+using PetaPoco.Tests.Integration.Providers;
using Xunit;
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleDatabaseTests : DatabaseTests
+ public abstract partial class OracleDatabaseTests : DatabaseTests
{
- public OracleDatabaseTests()
- : base(new OracleTestProvider())
+ protected OracleDatabaseTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleDatabaseTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleDatabaseTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+
+ ///
+ /// We need to retain the custom provider and default mapper specified in the test provider
+ /// to ensure correct logic is applied.
+ ///
+ protected override void AfterDbCreate(Database db)
+ {
+ base.AfterDbCreate(db);
+
+ // ReSharper disable once PossibleNullReferenceException
+ db.GetType().GetField("_provider", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(db, DB.Provider);
+ // ReSharper disable once PossibleNullReferenceException
+ db.GetType().GetField("_defaultMapper", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(db, DB.DefaultMapper);
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDeleteTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDeleteTests.cs
index 2ff1a9c7..da6ffc68 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDeleteTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleDeleteTests.cs
@@ -3,12 +3,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleDeleteTests : DeleteTests
+ public abstract partial class OracleDeleteTests : DeleteTests
{
- public OracleDeleteTests()
- : base(new OracleTestProvider())
+ protected OracleDeleteTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleDeleteTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleDeleteTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleExecuteTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleExecuteTests.cs
index 8e747d91..ea4de56d 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleExecuteTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleExecuteTests.cs
@@ -3,12 +3,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleExecuteTests : ExecuteTests
+ public abstract partial class OracleExecuteTests : ExecuteTests
{
- public OracleExecuteTests()
- : base(new OracleTestProvider())
+ protected OracleExecuteTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleExecuteTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleExecuteTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleInsertTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleInsertTests.cs
index 9b43b6a1..fd96a488 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleInsertTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleInsertTests.cs
@@ -5,12 +5,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleInsertTests : InsertTests
+ public abstract partial class OracleInsertTests : InsertTests
{
- public OracleInsertTests()
- : base(new OracleTestProvider())
+ protected OracleInsertTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleInsertTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleInsertTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleMiscellaneousTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleMiscellaneousTests.cs
index 8cc0bb05..20ce859b 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleMiscellaneousTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleMiscellaneousTests.cs
@@ -3,12 +3,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleMiscellaneousTests : MiscellaneousTests
+ public abstract partial class OracleMiscellaneousTests : MiscellaneousTests
{
- public OracleMiscellaneousTests()
- : base(new OracleTestProvider())
+ protected OracleMiscellaneousTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleMiscellaneousTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleMiscellaneousTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OraclePreExecuteTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OraclePreExecuteTests.cs
index 976906df..e88f36a1 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OraclePreExecuteTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OraclePreExecuteTests.cs
@@ -6,36 +6,79 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OraclePreExecuteTests : PreExecuteTests
+ public abstract partial class OraclePreExecuteTests : PreExecuteTests
{
- protected override IPreExecuteDatabaseProvider Provider => DB.Provider as PreExecuteDatabaseProvider;
-
- public OraclePreExecuteTests()
- : base(new PreExecuteTestProvider())
+ protected OraclePreExecuteTests(TestProvider provider)
+ : base(provider)
{
- Provider.ThrowExceptions = true;
}
- protected class PreExecuteTestProvider : OracleTestProvider
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OraclePreExecuteTests
{
- protected override IDatabase LoadFromConnectionName(string name)
- => BuildFromConnectionName(name).UsingProvider().Create();
+ protected override IPreExecuteDatabaseProvider Provider => DB.Provider as PreExecuteDatabaseProvider;
+
+ public Delimited()
+ : base(new PreExecuteTestProvider())
+ {
+ Provider.ThrowExceptions = true;
+ }
+
+ protected class PreExecuteTestProvider : OracleDelimitedTestProvider
+ {
+ protected override IDatabase LoadFromConnectionName(string name)
+ => BuildFromConnectionName(name).UsingProvider().Create();
+ }
+
+ protected class PreExecuteDatabaseProvider : PetaPoco.Providers.OracleDatabaseProvider, IPreExecuteDatabaseProvider
+ {
+ public bool ThrowExceptions { get; set; }
+ public List Parameters { get; set; } = new List();
+
+ public override void PreExecute(IDbCommand cmd)
+ {
+ Parameters.Clear();
+
+ if (ThrowExceptions)
+ {
+ Parameters = cmd.Parameters.Cast().ToList();
+ throw new PreExecuteException();
+ }
+ }
+ }
}
- protected class PreExecuteDatabaseProvider : PetaPoco.Providers.OracleDatabaseProvider, IPreExecuteDatabaseProvider
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OraclePreExecuteTests
{
- public bool ThrowExceptions { get; set; }
- public List Parameters { get; set; } = new List();
+ protected override IPreExecuteDatabaseProvider Provider => DB.Provider as PreExecuteDatabaseProvider;
+
+ public Ordinary()
+ : base(new PreExecuteTestProvider())
+ {
+ Provider.ThrowExceptions = true;
+ }
- public override void PreExecute(IDbCommand cmd)
+ protected class PreExecuteTestProvider : OracleOrdinaryTestProvider
{
- Parameters.Clear();
+ protected override IDatabase LoadFromConnectionName(string name)
+ => BuildFromConnectionName(name).UsingProvider().Create();
+ }
- if (ThrowExceptions)
+ protected class PreExecuteDatabaseProvider : PetaPoco.Providers.OracleDatabaseProvider, IPreExecuteDatabaseProvider
+ {
+ public bool ThrowExceptions { get; set; }
+ public List Parameters { get; set; } = new List();
+
+ public override void PreExecute(IDbCommand cmd)
{
- Parameters = cmd.Parameters.Cast().ToList();
- throw new PreExecuteException();
+ Parameters.Clear();
+
+ if (ThrowExceptions)
+ {
+ Parameters = cmd.Parameters.Cast().ToList();
+ throw new PreExecuteException();
+ }
}
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryLinqTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryLinqTests.cs
index 1e7db334..67090119 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryLinqTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryLinqTests.cs
@@ -3,12 +3,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleQueryLinqTests : QueryLinqTests
+ public abstract partial class OracleQueryLinqTests : QueryLinqTests
{
- public OracleQueryLinqTests()
- : base(new OracleTestProvider())
+ protected OracleQueryLinqTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleQueryLinqTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleQueryLinqTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryTests.cs
index 18c01da9..2de34e3c 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleQueryTests.cs
@@ -10,14 +10,31 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleQueryTests : QueryTests
+ public abstract partial class OracleQueryTests : QueryTests
{
- public OracleQueryTests()
- : base(new OracleTestProvider())
+ protected OracleQueryTests(TestProvider provider)
+ : base(provider)
{
}
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleQueryTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleQueryTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
+
[Fact]
public override async Task FetchAsyncWithPaging_ForDynamicTypeGivenSql_ShouldReturnValidDynamicTypeCollection()
{
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleStoredProcTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleStoredProcTests.cs
index 1cf298ef..8ee59f9a 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleStoredProcTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleStoredProcTests.cs
@@ -11,99 +11,138 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleStoredProcTests : StoredProcTests
+ public abstract partial class OracleStoredProcTests : StoredProcTests
{
protected override Type DataParameterType => typeof(OracleParameter);
- public OracleStoredProcTests()
- : base(new OracleTestProvider())
+
+ protected OracleStoredProcTests(TestProvider provider)
+ : base(provider)
{
}
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleStoredProcTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleStoredProcTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
+
private IDataParameter GetOutputParameter() => new OracleParameter("p_out_cursor", OracleDbType.RefCursor, ParameterDirection.Output);
[Fact]
public override void QueryProc_NoParam_ShouldReturnAll()
{
- var results = DB.QueryProc("SelectPeople", GetOutputParameter()).ToArray();
+ var results = DB.QueryProc(DB.Provider.EscapeTableName("SelectPeople"), GetOutputParameter()).ToArray();
results.Length.ShouldBe(6);
}
[Fact]
public override void QueryProc_WithParam_ShouldReturnSome()
{
- var results = DB.QueryProc("SelectPeopleWithParam", new { age = 20 }, GetOutputParameter()).ToArray();
+ var results = DB.QueryProc(DB.Provider.EscapeTableName("SelectPeopleWithParam"), new { age = 20 }, GetOutputParameter()).ToArray();
results.Length.ShouldBe(3);
}
[Fact]
public override void QueryProc_WithDbParam_ShouldReturnSome()
{
- var results = DB.QueryProc("SelectPeopleWithParam", GetDataParameter(), GetOutputParameter()).ToArray();
+ var results = DB.QueryProc(DB.Provider.EscapeTableName("SelectPeopleWithParam"), GetDataParameter(), GetOutputParameter()).ToArray();
results.Length.ShouldBe(3);
}
[Fact]
public override void FetchProc_NoParam_ShouldReturnAll()
{
- var results = DB.FetchProc("SelectPeople", GetOutputParameter());
+ var results = DB.FetchProc(DB.Provider.EscapeTableName("SelectPeople"), GetOutputParameter());
results.Count.ShouldBe(6);
}
[Fact]
public override void FetchProc_WithParam_ShouldReturnSome()
{
- var results = DB.FetchProc("SelectPeopleWithParam", new { age = 20 }, GetOutputParameter());
+ var results = DB.FetchProc(DB.Provider.EscapeTableName("SelectPeopleWithParam"), new { age = 20 }, GetOutputParameter());
results.Count.ShouldBe(3);
}
[Fact]
public override void FetchProc_WithDbParam_ShouldReturnSome()
{
- var results = DB.FetchProc("SelectPeopleWithParam", GetDataParameter(), GetOutputParameter());
+ var results = DB.FetchProc(DB.Provider.EscapeTableName("SelectPeopleWithParam"), GetDataParameter(), GetOutputParameter());
results.Count.ShouldBe(3);
}
[Fact]
public override void ScalarProc_NoParam_ShouldReturnAll()
{
- var count = DB.ExecuteScalarProc("CountPeople", GetOutputParameter());
+ var count = DB.ExecuteScalarProc(DB.Provider.EscapeTableName("CountPeople"), GetOutputParameter());
count.ShouldBe(6);
}
[Fact]
public override void ScalarProc_WithParam_ShouldReturnSome()
{
- var count = DB.ExecuteScalarProc("CountPeopleWithParam", new { age = 20 }, GetOutputParameter());
+ var count = DB.ExecuteScalarProc(DB.Provider.EscapeTableName("CountPeopleWithParam"), new { age = 20 }, GetOutputParameter());
count.ShouldBe(3);
}
[Fact]
public override void ScalarProc_WithDbParam_ShouldReturnSome()
{
- var count = DB.ExecuteScalarProc("CountPeopleWithParam", GetDataParameter(), GetOutputParameter());
+ var count = DB.ExecuteScalarProc(DB.Provider.EscapeTableName("CountPeopleWithParam"), GetDataParameter(), GetOutputParameter());
count.ShouldBe(3);
}
[Fact]
public override void NonQueryProc_NoParam_ShouldUpdateAll()
{
- DB.ExecuteNonQueryProc("UpdatePeople");
+ DB.ExecuteNonQueryProc(DB.Provider.EscapeTableName("UpdatePeople"));
DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(6);
}
[Fact]
public override void NonQueryProc_WithParam_ShouldUpdateSome()
{
- DB.ExecuteNonQueryProc("UpdatePeopleWithParam", new { age = 20 });
+ DB.ExecuteNonQueryProc(DB.Provider.EscapeTableName("UpdatePeopleWithParam"), new { age = 20 });
DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(3);
}
[Fact]
public override void NonQueryProc_WithDbParam_ShouldUpdateSome()
{
- DB.ExecuteNonQueryProc("UpdatePeopleWithParam", GetDataParameter());
+ DB.ExecuteNonQueryProc(DB.Provider.EscapeTableName("UpdatePeopleWithParam"), GetDataParameter());
+ DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(3);
+ }
+
+ [Fact]
+ public override async Task NonQueryProcAsync_NoParam_ShouldUpdateAll()
+ {
+ await DB.ExecuteNonQueryProcAsync(DB.Provider.EscapeSqlIdentifier("UpdatePeople"));
+ DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(6);
+ }
+
+ [Fact]
+ public override async Task NonQueryProcAsync_WithParam_ShouldUpdateSome()
+ {
+ await DB.ExecuteNonQueryProcAsync(DB.Provider.EscapeTableName("UpdatePeopleWithParam"), new { age = 20 });
+ DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(3);
+ }
+
+ [Fact]
+ public override async Task NonQueryProcAsync_WithDbParam_ShouldUpdateSome()
+ {
+ await DB.ExecuteNonQueryProcAsync(DB.Provider.EscapeTableName("UpdatePeopleWithParam"), GetDataParameter());
DB.Query($"WHERE {DB.Provider.EscapeSqlIdentifier("FullName")}='Updated'").Count().ShouldBe(3);
}
@@ -111,7 +150,7 @@ public override void NonQueryProc_WithDbParam_ShouldUpdateSome()
public override async Task QueryProcAsync_NoParam_ShouldReturnAll()
{
var results = new List();
- await DB.QueryProcAsync(p => results.Add(p), "SelectPeople", GetOutputParameter());
+ await DB.QueryProcAsync(p => results.Add(p), DB.Provider.EscapeTableName("SelectPeople"), GetOutputParameter());
results.Count.ShouldBe(6);
}
@@ -119,7 +158,7 @@ public override async Task QueryProcAsync_NoParam_ShouldReturnAll()
public override async Task QueryProcAsync_WithParam_ShouldReturnSome()
{
var results = new List();
- await DB.QueryProcAsync(p => results.Add(p), "SelectPeopleWithParam", new { age = 20 }, GetOutputParameter());
+ await DB.QueryProcAsync(p => results.Add(p), DB.Provider.EscapeTableName("SelectPeopleWithParam"), new { age = 20 }, GetOutputParameter());
results.Count.ShouldBe(3);
}
@@ -127,7 +166,7 @@ public override async Task QueryProcAsync_WithParam_ShouldReturnSome()
public override async Task QueryProcAsync_WithDbParam_ShouldReturnSome()
{
var results = new List();
- await DB.QueryProcAsync(p => results.Add(p), "SelectPeopleWithParam", GetDataParameter(), GetOutputParameter());
+ await DB.QueryProcAsync(p => results.Add(p), DB.Provider.EscapeTableName("SelectPeopleWithParam"), GetDataParameter(), GetOutputParameter());
results.Count.ShouldBe(3);
}
@@ -135,7 +174,7 @@ public override async Task QueryProcAsync_WithDbParam_ShouldReturnSome()
public override async Task QueryProcAsyncReader_NoParam_ShouldReturnAll()
{
var results = new List();
- using (var reader = await DB.QueryProcAsync("SelectPeople", GetOutputParameter()))
+ using (var reader = await DB.QueryProcAsync(DB.Provider.EscapeTableName("SelectPeople"), GetOutputParameter()))
{
while (await reader.ReadAsync())
results.Add(reader.Poco);
@@ -147,7 +186,7 @@ public override async Task QueryProcAsyncReader_NoParam_ShouldReturnAll()
public override async Task QueryProcAsyncReader_WithParam_ShouldReturnSome()
{
var results = new List();
- using (var reader = await DB.QueryProcAsync("SelectPeopleWithParam", new { age = 20 }, GetOutputParameter()))
+ using (var reader = await DB.QueryProcAsync(DB.Provider.EscapeTableName("SelectPeopleWithParam"), new { age = 20 }, GetOutputParameter()))
{
while (await reader.ReadAsync())
results.Add(reader.Poco);
@@ -159,7 +198,7 @@ public override async Task QueryProcAsyncReader_WithParam_ShouldReturnSome()
public override async Task QueryProcAsyncReader_WithDbParam_ShouldReturnSome()
{
var results = new List();
- using (var reader = await DB.QueryProcAsync("SelectPeopleWithParam", GetDataParameter(), GetOutputParameter()))
+ using (var reader = await DB.QueryProcAsync(DB.Provider.EscapeTableName("SelectPeopleWithParam"), GetDataParameter(), GetOutputParameter()))
{
while (await reader.ReadAsync())
results.Add(reader.Poco);
@@ -170,42 +209,42 @@ public override async Task QueryProcAsyncReader_WithDbParam_ShouldReturnSome()
[Fact]
public override async Task FetchProcAsync_NoParam_ShouldReturnAll()
{
- var results = await DB.FetchProcAsync("SelectPeople", GetOutputParameter());
+ var results = await DB.FetchProcAsync(DB.Provider.EscapeTableName("SelectPeople"), GetOutputParameter());
results.Count.ShouldBe(6);
}
[Fact]
public override async Task FetchProcAsync_WithParam_ShouldReturnSome()
{
- var results = await DB.FetchProcAsync("SelectPeopleWithParam", new { age = 20 }, GetOutputParameter());
+ var results = await DB.FetchProcAsync(DB.Provider.EscapeTableName("SelectPeopleWithParam"), new { age = 20 }, GetOutputParameter());
results.Count.ShouldBe(3);
}
[Fact]
public override async Task FetchProcAsync_WithDbParam_ShouldReturnSome()
{
- var results = await DB.FetchProcAsync("SelectPeopleWithParam", GetDataParameter(), GetOutputParameter());
+ var results = await DB.FetchProcAsync(DB.Provider.EscapeTableName("SelectPeopleWithParam"), GetDataParameter(), GetOutputParameter());
results.Count.ShouldBe(3);
}
[Fact]
public override async Task ScalarProcAsync_NoParam_ShouldReturnAll()
{
- var count = await DB.ExecuteScalarProcAsync("CountPeople", GetOutputParameter());
+ var count = await DB.ExecuteScalarProcAsync(DB.Provider.EscapeTableName("CountPeople"), GetOutputParameter());
count.ShouldBe(6);
}
[Fact]
public override async Task ScalarProcAsync_WithParam_ShouldReturnSome()
{
- var count = await DB.ExecuteScalarProcAsync("CountPeopleWithParam", new { age = 20 }, GetOutputParameter());
+ var count = await DB.ExecuteScalarProcAsync(DB.Provider.EscapeTableName("CountPeopleWithParam"), new { age = 20 }, GetOutputParameter());
count.ShouldBe(3);
}
[Fact]
public override async Task ScalarProcAsync_WithDbParam_ShouldReturnSome()
{
- var count = await DB.ExecuteScalarProcAsync("CountPeopleWithParam", GetDataParameter(), GetOutputParameter());
+ var count = await DB.ExecuteScalarProcAsync(DB.Provider.EscapeTableName("CountPeopleWithParam"), GetDataParameter(), GetOutputParameter());
count.ShouldBe(3);
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleTriageTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleTriageTests.cs
index 9d7617ed..747b98a3 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleTriageTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleTriageTests.cs
@@ -3,12 +3,29 @@
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleTriageTests : TriageTests
+ public abstract partial class OracleTriageTests : TriageTests
{
- public OracleTriageTests()
- : base(new OracleTestProvider())
+ protected OracleTriageTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleTriageTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleTriageTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleUpdateTests.cs b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleUpdateTests.cs
index 914549a0..7e9b4385 100644
--- a/PetaPoco.Tests.Integration/Databases/OracleTests/OracleUpdateTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/OracleTests/OracleUpdateTests.cs
@@ -1,14 +1,80 @@
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using PetaPoco.Core;
+using PetaPoco.Tests.Integration.Models;
using PetaPoco.Tests.Integration.Providers;
+using Shouldly;
using Xunit;
namespace PetaPoco.Tests.Integration.Databases.Oracle
{
- [Collection("Oracle")]
- public class OracleUpdateTests : UpdateTests
+ public abstract partial class OracleUpdateTests : UpdateTests
{
- public OracleUpdateTests()
- : base(new OracleTestProvider())
+ protected OracleUpdateTests(TestProvider provider)
+ : base(provider)
{
}
+
+ [Collection("Oracle.Delimited")]
+ public class Delimited : OracleUpdateTests
+ {
+ public Delimited()
+ : base(new OracleDelimitedTestProvider())
+ {
+ }
+ }
+
+ [Collection("Oracle.Ordinary")]
+ public class Ordinary : OracleUpdateTests
+ {
+ public Ordinary()
+ : base(new OracleOrdinaryTestProvider())
+ {
+ }
+
+ [Fact]
+ public override void Update_GivenTablePrimaryKeyNameAndDynamicType_ShouldUpdate()
+ {
+ var pd = PocoData.ForType(typeof(Note), DB.DefaultMapper);
+ var tblNote = DB.Provider.EscapeTableName(pd.TableInfo.TableName);
+
+ CreateNote();
+ var entity = DB.Fetch($"SELECT * FROM {tblNote}").First();
+
+ entity.TEXT += " was updated";
+
+#if !NETCOREAPP
+ DB.Update("Note", "Id", (object)entity);
+#else
+ DB.Update("Note", "Id", entity);
+#endif
+
+ var entity2 = DB.Fetch($"SELECT * FROM {tblNote}").First();
+ ((string)entity2.TEXT).ShouldContain("updated");
+ }
+
+
+ [Fact]
+ public override async Task UpdateAsync_GivenTablePrimaryKeyNameAndDynamicType_ShouldUpdate()
+ {
+ var pd = PocoData.ForType(typeof(Note), DB.DefaultMapper);
+ var tblNote = DB.Provider.EscapeTableName(pd.TableInfo.TableName);
+
+ await CreateNoteAsync();
+ var entity = (await DB.FetchAsync($"SELECT * FROM {tblNote}")).First();
+
+ entity.TEXT += " was updated";
+
+#if !NETCOREAPP
+ await DB.UpdateAsync("Note", "Id", (object)entity);
+#else
+ await DB.UpdateAsync("Note", "Id", entity);
+#endif
+
+ var entity2 = (await DB.FetchAsync($"SELECT * FROM {tblNote}")).First();
+ ((string)entity2.TEXT).ShouldContain("updated");
+ }
+ }
}
}
diff --git a/PetaPoco.Tests.Integration/Databases/UpdateTests.cs b/PetaPoco.Tests.Integration/Databases/UpdateTests.cs
index 93571be2..5539b969 100644
--- a/PetaPoco.Tests.Integration/Databases/UpdateTests.cs
+++ b/PetaPoco.Tests.Integration/Databases/UpdateTests.cs
@@ -81,6 +81,8 @@ protected static void UpdateProperties(OrderLine orderLine)
orderLine.Status = OrderLineStatus.Allocated;
}
+ protected object CreateNote() => DB.Insert(_note);
+ protected Task