Skip to content

Commit baa555f

Browse files
committed
Fix error in Dibix.Sdk.Tests.Database
1 parent 62955c9 commit baa555f

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

tests/Dibix.Sdk.Tests.Database/CodeAnalysis/dbx_codeanalysis_error_042.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ BEGIN
1111
SET ROWCOUNT 0 -- Fail => Unsupported option => Default is 0
1212
SET STATISTICS TIME ON -- Fail => Unsupported option
1313
SET TEXTSIZE 0 -- Fail => Unsupported option
14-
SETUSER N'x' -- Fail => Unsupported option
14+
SETUSER -- Fail => Unsupported option
1515
SET DEADLOCK_PRIORITY HIGH -- Fail => Unsupported setting value
1616
SET NOCOUNT OFF -- Fail => Unsupported setting value
1717
SET XACT_ABORT OFF -- Fail => Unsupported setting value

tests/Dibix.Sdk.Tests/CodeAnalysis/SqlCodeAnalysisRuleTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4-
using System.Diagnostics;
54
using System.IO;
65
using System.Linq;
76
using System.Reflection;
@@ -32,9 +31,14 @@ partial void Execute(string testName)
3231
.Select(x => new TaskItem(x.Value) { ["FullPath"] = Path.Combine(DatabaseTestUtility.DatabaseProjectDirectory, x.Value) })
3332
.ToArray();
3433

34+
// master.dacpac is actually required otherwise causes this error:
35+
// CodeAnalysis\dbx_codeanalysis_error_002.sql(84,10,84,10):error 71502:Procedure: [dbo].[dbx_codeanalysis_error_002_x] has an unresolved reference to object [dbo].[sp_executesql].
36+
// The master.dacpac lies in the VS IDE folder with an installed SSDT, which is not available in CI builds, therefore ignore it for now.
37+
ICollection<TaskItem> references = Array.Empty<TaskItem>();
38+
3539
TestLogger logger = new TestLogger(base.Out, distinctErrorLogging: true);
3640

37-
TSqlModel model = PublicSqlDataSchemaModelLoader.Load(DatabaseTestUtility.ProjectName, DatabaseTestUtility.DatabaseSchemaProviderName, DatabaseTestUtility.ModelCollation, sources, Array.Empty<TaskItem>(), logger);
41+
TSqlModel model = PublicSqlDataSchemaModelLoader.Load(DatabaseTestUtility.ProjectName, DatabaseTestUtility.DatabaseSchemaProviderName, DatabaseTestUtility.ModelCollation, sources, references, logger);
3842
LockEntryManager lockEntryManager = LockEntryManager.Create();
3943
ISqlCodeAnalysisRuleEngine engine = SqlCodeAnalysisRuleEngine.Create(model, DatabaseTestUtility.ProjectName, new SqlCodeAnalysisConfiguration("dbx"), false, lockEntryManager, logger);
4044
IEnumerable<SqlCodeAnalysisError> errors = engine.Analyze(violationScriptPath, ruleInstance);

tests/Dibix.Sdk.Tests/Resources/CodeAnalysis/SetStatementSqlCodeAnalysisRule.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
column="5" />
4848
<error
4949
ruleid="42"
50-
message="Unsupported SET statement: SETUSER N'x'"
50+
message="Unsupported SET statement: SETUSER"
5151
line="14"
5252
column="5" />
5353
<error

0 commit comments

Comments
 (0)