Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This test:
```cs
await Verify(connection);
```
<sup><a href='/src/Tests/Tests.cs#L300-L304' title='Snippet source file'>snippet source</a> | <a href='#snippet-SqlServerSchema' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L317-L321' title='Snippet source file'>snippet source</a> | <a href='#snippet-SqlServerSchema' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Will result in the following verified file:
Expand All @@ -69,7 +69,7 @@ await Verify(connection)
// include only tables and views
.SchemaIncludes(DbObjects.Tables | DbObjects.Views);
```
<sup><a href='/src/Tests/Tests.cs#L666-L672' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaInclude' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L683-L689' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaInclude' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Available values:
Expand Down Expand Up @@ -107,7 +107,7 @@ await Verify(connection)
_ => _ is TableViewBase ||
_.Name == "MyTrigger");
```
<sup><a href='/src/Tests/Tests.cs#L691-L699' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaFilter' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L708-L716' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaFilter' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -129,7 +129,7 @@ command.CommandText = "select Value from MyTable";
var value = await command.ExecuteScalarAsync();
await Verify(value!);
```
<sup><a href='/src/Tests/Tests.cs#L475-L485' title='Snippet source file'>snippet source</a> | <a href='#snippet-Recording' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L492-L502' title='Snippet source file'>snippet source</a> | <a href='#snippet-Recording' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Will result in the following verified file:
Expand Down Expand Up @@ -184,7 +184,7 @@ await Verify(
sqlEntries = entries
});
```
<sup><a href='/src/Tests/Tests.cs#L552-L582' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSpecific' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L569-L599' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSpecific' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -212,7 +212,7 @@ var sqlErrorsViaType = entries
.Select(_ => _.Data)
.OfType<ErrorEntry>();
```
<sup><a href='/src/Tests/Tests.cs#L608-L627' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingReadingResults' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Tests.cs#L625-L644' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingReadingResults' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
10 changes: 10 additions & 0 deletions src/Tests/Tests.Schema.verified.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ BEGIN
END;
```

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```

### ProcWithParams

```sql
Expand Down
11 changes: 11 additions & 0 deletions src/Tests/Tests.SchemaAnsiNullsOff.verified.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## StoredProcedures

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```
10 changes: 10 additions & 0 deletions src/Tests/Tests.SchemaAsMarkdown.verified.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ BEGIN
END;
```

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```

### ProcWithParams

```sql
Expand Down
6 changes: 6 additions & 0 deletions src/Tests/Tests.SchemaAsSql.verified.sql
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ BEGIN
WHERE (Value > 10);
END;

CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;

CREATE PROCEDURE ProcWithParams
@Id int,
@Name nvarchar(100),
Expand Down
10 changes: 10 additions & 0 deletions src/Tests/Tests.SchemaInDynamic.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,16 @@ BEGIN
END;
```

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```

### ProcWithParams

```sql
Expand Down
10 changes: 10 additions & 0 deletions src/Tests/Tests.SchemaIncludeAll.verified.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ BEGIN
END;
```

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```

### ProcWithParams

```sql
Expand Down
10 changes: 10 additions & 0 deletions src/Tests/Tests.SchemaIncludeStoredProceduresOnly.verified.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ BEGIN
END;
```

### ProcWithAnsiNullsOff

```sql
CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
```

### ProcWithParams

```sql
Expand Down
30 changes: 30 additions & 0 deletions src/Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,23 @@ FROM TestSchema.SchemaTable

create synonym TestSchema.SchemaSynonym
for TestSchema.SchemaTable;
GO

SET ANSI_NULLS OFF;
GO
SET QUOTED_IDENTIFIER OFF;
GO

CREATE PROCEDURE ProcWithAnsiNullsOff
AS
BEGIN
SELECT Value FROM MyTable;
END;
GO

SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
""");
return Task.CompletedTask;
});
Expand Down Expand Up @@ -789,4 +806,17 @@ public async Task SchemaAsMarkdown()
await Verify(connection)
.SchemaAsMarkdown();
}

[Test]
public async Task SchemaAnsiNullsOff()
{
await using var database = await sqlInstance.Build();
var connection = database.Connection;

// ProcWithAnsiNullsOff was created with SET ANSI_NULLS OFF and SET QUOTED_IDENTIFIER OFF.
// Verify the SET statements are stripped from the output.
await Verify(connection)
.SchemaFilter(_ => _.Name == "ProcWithAnsiNullsOff")
.SchemaIncludes(DbObjects.StoredProcedures);
}
}
4 changes: 3 additions & 1 deletion src/Verify.SqlServer/SchemaValidation/SqlScriptBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,7 @@ static List<string> ScriptLines<T>(ScriptingOptions options, T item)
static bool IsSet(string script) =>
script is
"SET ANSI_NULLS ON" or
"SET QUOTED_IDENTIFIER ON";
"SET ANSI_NULLS OFF" or
"SET QUOTED_IDENTIFIER ON" or
"SET QUOTED_IDENTIFIER OFF";
}
Loading