Skip to content

Commit 4cd7e66

Browse files
committed
Extend ITestContextFacade
1 parent f18fa16 commit 4cd7e66

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/Dibix.Sdk.Sql/SqlModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public SqlModel(string source, TSqlFragment scriptFragment, bool isScriptArtifac
3232
return null;
3333

3434
TSqlObject table = columnElement.GetParent(DacQueryScopes.All);
35+
if (table == null)
36+
return null;
37+
3538
TSqlObject primaryKey = table.GetReferencing(PrimaryKeyConstraint.Host, DacQueryScopes.All).First();
3639
return primaryKey?.GetReferenced(PrimaryKeyConstraint.Columns, DacQueryScopes.All).Contains(columnElement) ?? default;
3740
}

src/Dibix.Testing/ITestContextFacade.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ public interface ITestContextFacade
1010
{
1111
TestContext TestContext { get; }
1212
TextWriter Out { get; }
13+
string RunDirectory { get; }
14+
string TestDirectory { get; }
1315
TestClassInstanceScope Scope { get; }
1416

17+
string AddTestFile(string fileName);
1518
string AddTestFile(string fileName, string content);
1619
string AddTestRunFile(string fileName);
1720
string ImportTestRunFile(string filePath);

src/Dibix.Testing/TestBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ private static T SafeGetProperty<T>(ref T field, [CallerMemberName] string prope
265265
#region ITestContextFacade Members
266266
TestContext ITestContextFacade.TestContext => TestContext;
267267
TextWriter ITestContextFacade.Out => Out;
268+
string ITestContextFacade.RunDirectory => RunDirectory;
269+
string ITestContextFacade.TestDirectory => TestDirectory;
268270
TestClassInstanceScope ITestContextFacade.Scope => Scope;
269271

272+
string ITestContextFacade.AddTestFile(string fileName) => AddTestFile(fileName);
270273
string ITestContextFacade.AddTestFile(string fileName, string content) => AddTestFile(fileName, content);
271274
string ITestContextFacade.AddTestRunFile(string fileName) => AddTestRunFile(fileName);
272275

src/Dibix/Parameter/DbProviderAdapter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Data;
33
using System.Data.Common;
4-
using System.Linq;
54

65
namespace Dibix
76
{
@@ -33,7 +32,7 @@ public void AttachInfoMessageHandler(Action<string> handler)
3332

3433
public void MapStructuredTypeToParameter(IDbDataParameter parameter, StructuredType type)
3534
{
36-
bool hasRecords = type.GetRecords().Any();
35+
bool hasRecords = type.Count > 0;
3736
parameter.Value = hasRecords ? GetStructuredTypeParameterValue(type) : null;
3837
SetProviderSpecificParameterProperties(parameter, SqlDbType.Structured, type.TypeName);
3938
}

0 commit comments

Comments
 (0)