diff --git a/TableDependency.SqlClient.Test/Inheritance/SqlTableDependencyTest.cs b/TableDependency.SqlClient.Test/Inheritance/SqlTableDependencyTest.cs index db5dfb6..51cab25 100644 --- a/TableDependency.SqlClient.Test/Inheritance/SqlTableDependencyTest.cs +++ b/TableDependency.SqlClient.Test/Inheritance/SqlTableDependencyTest.cs @@ -177,7 +177,7 @@ protected override IList CreateSqlServerDatabaseObjects(IEnumerable - WaitForNotifications( - _cancellationTokenSource.Token, - onChangedSubscribedList, - onErrorSubscribedList, - onStatusChangedSubscribedList, - timeOut, - watchDogTimeOut), - _cancellationTokenSource.Token); + _task = WaitForNotifications(_cancellationTokenSource.Token, onChangedSubscribedList, onErrorSubscribedList, + onStatusChangedSubscribedList, timeOut, watchDogTimeOut); this.WriteTraceMessage(TraceLevel.Info, $"Waiting for receiving {_tableName}'s records change notifications."); } @@ -192,7 +185,7 @@ public override void Stop() if (_task != null) { _cancellationTokenSource.Cancel(true); - _task?.Wait(); + _task.Wait(); } _task = null; @@ -382,7 +375,7 @@ protected override void DropDatabaseObjects() return string.Format("IF EXISTS (SELECT * FROM sys.service_message_types WITH (NOLOCK) WHERE name = N'{0}') DROP MESSAGE TYPE [{0}];", pm); })); - var dropAllScript = this.PrepareScriptDropAll(dropMessages); + var dropAllScript = this.PrepareScriptDropAll(dropMessages, false); sqlCommand.Transaction = sqlTransaction; sqlCommand.CommandType = CommandType.Text; @@ -525,7 +518,8 @@ protected virtual IList CreateSqlServerDatabaseObjects(IEnumerable CreateSqlServerDatabaseObjects(IEnumerable