diff --git a/latest/SqlCodeAnalysisRules.props b/latest/SqlCodeAnalysisRules.props index 032a4b4..2923d6b 100644 --- a/latest/SqlCodeAnalysisRules.props +++ b/latest/SqlCodeAnalysisRules.props @@ -6,7 +6,6 @@ -SqlServer.Rules.SRD0009; $(CodeAnalysisRules) -SqlServer.Rules.SRD0013; $(CodeAnalysisRules) -SqlServer.Rules.SRD0015; $(CodeAnalysisRules) - -SqlServer.Rules.SRD0016; $(CodeAnalysisRules) -SqlServer.Rules.SRD0017; $(CodeAnalysisRules) -SqlServer.Rules.SRD0024; $(CodeAnalysisRules) -SqlServer.Rules.SRD0026; $(CodeAnalysisRules) diff --git a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_AssertEqualsTable.sql b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_AssertEqualsTable.sql index 1b8d6d7..c9ebb2c 100644 --- a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_AssertEqualsTable.sql +++ b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_AssertEqualsTable.sql @@ -49,6 +49,19 @@ BEGIN END; GO +CREATE PROCEDURE Test_AssertEqualsTable.Test_ErrorMessage_FailMsg +AS +BEGIN + CREATE TABLE dbo.TestTable1 (Column1 INT); + CREATE TABLE dbo.TestTable2 (Column1 INT); + INSERT INTO dbo.TestTable1 (Column1) VALUES (1); + + EXEC tSQLt.ExpectException 'Error message. Fail message. tSQLt.AssertEqualsTable failed. Expected: has different rowset than Actual:.'; + + EXEC tSQLt.AssertEqualsTable 'dbo.TestTable1', 'dbo.TestTable2', 'Error message.', 'Fail message.'; +END; +GO + CREATE PROCEDURE Test_AssertEqualsTable.Test_SecondTableIsNotEmpty AS BEGIN diff --git a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_DropClass.sql b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_DropClass.sql index 36e81e4..2c49903 100644 --- a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_DropClass.sql +++ b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_DropClass.sql @@ -4,7 +4,7 @@ GO CREATE PROCEDURE Test_DropClass.Test_IsUnsupported AS BEGIN - EXEC tSQLt.ExpectException 'tSQLt.DropClass is not supported.' + EXEC tSQLt.ExpectException 'tSQLt.DropClass of TestClass1 is not supported.' EXEC tSQLt.DropClass 'TestClass1'; END; diff --git a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_NewTestClass.sql b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_NewTestClass.sql index e311676..827e385 100644 --- a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_NewTestClass.sql +++ b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_NewTestClass.sql @@ -4,7 +4,7 @@ GO CREATE PROCEDURE Test_NewTestClass.Test_IsUnsupported AS BEGIN - EXEC tSQLt.ExpectException 'tSQLt.NewTestClass is not supported. Use CREATE SCHEMA ''ClassName''.' + EXEC tSQLt.ExpectException 'tSQLt.NewTestClass of TestClass1 is not supported.' EXEC tSQLt.NewTestClass 'TestClass1'; END; diff --git a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_RenameClass.sql b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_RenameClass.sql index e494f05..74ab4a9 100644 --- a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_RenameClass.sql +++ b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_RenameClass.sql @@ -4,7 +4,7 @@ GO CREATE PROCEDURE Test_RenameClass.Test_IsUnsupported AS BEGIN - EXEC tSQLt.ExpectException 'tSQLt.RenameClass is not supported.' + EXEC tSQLt.ExpectException 'tSQLt.RenameClass of TestClass1 to NewTestClass1 is not supported.' EXEC tSQLt.RenameClass 'TestClass1', 'NewTestClass1'; END; diff --git a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_Run.sql b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_Run.sql index 2d7bbc8..67ff9b6 100644 --- a/latest/tSQLt.Edge.Tests/InterfaceTests/Test_Run.sql +++ b/latest/tSQLt.Edge.Tests/InterfaceTests/Test_Run.sql @@ -23,4 +23,13 @@ BEGIN EXEC tSQLt.Fail 'dbo.NewTable should not exists.'; END END; +GO + +CREATE PROCEDURE Test_Run.Test_ResultFormatter_IsUnsupported +AS +BEGIN + EXEC tSQLt.ExpectException 'tSQLt.Run with @TestResultFormatter is not supported.' + + EXEC tSQLt.Run '[Test_Run].[Test_CreateNewTable]', @TestResultFormatter = 'ResultFormatter'; +END; GO \ No newline at end of file diff --git a/latest/tSQLt.Edge/Internal/tSQLt.Internal_AssertEqualsTable.sql b/latest/tSQLt.Edge/Internal/tSQLt.Internal_AssertEqualsTable.sql index b70a041..8969c68 100644 --- a/latest/tSQLt.Edge/Internal/tSQLt.Internal_AssertEqualsTable.sql +++ b/latest/tSQLt.Edge/Internal/tSQLt.Internal_AssertEqualsTable.sql @@ -16,6 +16,7 @@ BEGIN DECLARE @Failed NVARCHAR(MAX) = CONCAT_WS ( ' ', + NULLIF(@FailMsg, 'Unexpected/missing resultset rows!'), 'tSQLt.AssertEqualsTable failed.', CONCAT('Expected:<', ISNULL(@Expected, '(null)'), '>'), 'has different rowset than', @@ -23,5 +24,7 @@ BEGIN ); EXEC tSQLt.Fail @Message, @Failed; END + + SET @FailMsg = NULL END; GO \ No newline at end of file diff --git a/latest/tSQLt.Edge/Internal/tSQLt.Internal_DropClass.sql b/latest/tSQLt.Edge/Internal/tSQLt.Internal_DropClass.sql index 1d63378..c6f554c 100644 --- a/latest/tSQLt.Edge/Internal/tSQLt.Internal_DropClass.sql +++ b/latest/tSQLt.Edge/Internal/tSQLt.Internal_DropClass.sql @@ -2,6 +2,6 @@ CREATE PROCEDURE tSQLt.Internal_DropClass @ClassName NVARCHAR(MAX) AS BEGIN - EXEC tSQLt.Fail 'tSQLt.DropClass is not supported.'; + EXEC tSQLt.Fail 'tSQLt.DropClass of', @ClassName, 'is not supported.'; END; GO \ No newline at end of file diff --git a/latest/tSQLt.Edge/Internal/tSQLt.Internal_NewTestClass.sql b/latest/tSQLt.Edge/Internal/tSQLt.Internal_NewTestClass.sql index 8eb8d65..b476da9 100644 --- a/latest/tSQLt.Edge/Internal/tSQLt.Internal_NewTestClass.sql +++ b/latest/tSQLt.Edge/Internal/tSQLt.Internal_NewTestClass.sql @@ -2,6 +2,6 @@ CREATE PROCEDURE tSQLt.Internal_NewTestClass @ClassName NVARCHAR(MAX) AS BEGIN - EXEC tSQLt.Fail 'tSQLt.NewTestClass is not supported. Use CREATE SCHEMA ''ClassName''.'; + EXEC tSQLt.Fail 'tSQLt.NewTestClass of', @ClassName, 'is not supported.'; END; GO \ No newline at end of file diff --git a/latest/tSQLt.Edge/Internal/tSQLt.Internal_RenameClass.sql b/latest/tSQLt.Edge/Internal/tSQLt.Internal_RenameClass.sql index 211bf64..515eeae 100644 --- a/latest/tSQLt.Edge/Internal/tSQLt.Internal_RenameClass.sql +++ b/latest/tSQLt.Edge/Internal/tSQLt.Internal_RenameClass.sql @@ -3,6 +3,6 @@ CREATE PROCEDURE tSQLt.Internal_RenameClass @NewSchemaName NVARCHAR(MAX) AS BEGIN - EXEC tSQLt.Fail 'tSQLt.RenameClass is not supported.'; + EXEC tSQLt.Fail 'tSQLt.RenameClass of', @SchemaName, 'to', @NewSchemaName, 'is not supported.'; END; GO \ No newline at end of file diff --git a/latest/tSQLt.Edge/Internal/tSQLt.Internal_Run.sql b/latest/tSQLt.Edge/Internal/tSQLt.Internal_Run.sql index d3ca05a..a757d08 100644 --- a/latest/tSQLt.Edge/Internal/tSQLt.Internal_Run.sql +++ b/latest/tSQLt.Edge/Internal/tSQLt.Internal_Run.sql @@ -3,6 +3,11 @@ CREATE PROCEDURE tSQLt.Internal_Run @TestResultFormatter NVARCHAR(MAX) = NULL AS BEGIN + IF @TestResultFormatter IS NOT NULL + BEGIN + EXEC tSQLt.Fail 'tSQLt.Run with @TestResultFormatter is not supported.'; + END + DELETE FROM tSQLt.TestResult; DECLARE @TestNames tSQLt.Private_TestNamesType; diff --git a/latest/tSQLt.Edge/Private/tSQLt.Private_Run.sql b/latest/tSQLt.Edge/Private/tSQLt.Private_Run.sql index e64d0c7..7f05d23 100644 --- a/latest/tSQLt.Edge/Private/tSQLt.Private_Run.sql +++ b/latest/tSQLt.Edge/Private/tSQLt.Private_Run.sql @@ -14,7 +14,7 @@ BEGIN IF @TranCounter = 0 BEGIN TRANSACTION; ELSE - SAVE TRANSACTION @TestName; + SAVE TRANSACTION @TranName; BEGIN TRY EXEC @TestName; @@ -33,6 +33,6 @@ BEGIN ROLLBACK TRANSACTION; ELSE IF XACT_STATE() <> -1 - ROLLBACK TRANSACTION @TestName; + ROLLBACK TRANSACTION @TranName; END; GO \ No newline at end of file diff --git a/legacy/tSQLt.Unoriginal.Tests/Post-Deployment/Debug.sql b/legacy/tSQLt.Unoriginal.Tests/Post-Deployment/Debug.sql index b3c35a5..f271756 100644 --- a/legacy/tSQLt.Unoriginal.Tests/Post-Deployment/Debug.sql +++ b/legacy/tSQLt.Unoriginal.Tests/Post-Deployment/Debug.sql @@ -87,6 +87,7 @@ END; -- Failure EXEC ('DROP PROCEDURE [Test_AssertEqualsTable].[Test_ErrorMessage]'); + EXEC ('DROP PROCEDURE [Test_AssertEqualsTable].[Test_ErrorMessage_FailMsg]'); EXEC ('DROP PROCEDURE [Test_AssertEqualsTable].[Test_FirstTableHasTwinRows]'); EXEC ('DROP PROCEDURE [Test_AssertEqualsTable].[Test_FirstTableIsNotEmpty]'); EXEC ('DROP PROCEDURE [Test_AssertEqualsTable].[Test_FloatLossOfPrecision]');