diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/EditSession.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/EditSession.cs index 5a923faa..6e9e2774 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/EditSession.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/EditSession.cs @@ -528,10 +528,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData { // Get the command from the edit operation and execute it using (DbCommand editCommand = editOperation.GetCommand(connection)) - using (DbDataReader reader = await editCommand.ExecuteReaderAsync()) + using (DbDataReader reader = editCommand.ExecuteReader()) { // Apply the changes of the command to the result set - await editOperation.ApplyChanges(reader); + editOperation.ApplyChanges(reader); } } catch (EditDataDeleteException) diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowCreate.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowCreate.cs index 92a72629..c55a5c96 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowCreate.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowCreate.cs @@ -12,7 +12,6 @@ using System.Data.Common; using Microsoft.Data.SqlClient; using System.Linq; using System.Text; -using System.Threading.Tasks; using Microsoft.SqlTools.ServiceLayer.EditData.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; @@ -74,11 +73,11 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement /// Reader returned from the execution of the command to insert a new row. Should contain /// a single row that represents the newly added row. /// - public override Task ApplyChanges(DbDataReader dataReader) + public override void ApplyChanges(DbDataReader dataReader) { Validate.IsNotNull(nameof(dataReader), dataReader); - return AssociatedResultSet.AddRow(dataReader); + AssociatedResultSet.AddRow(dataReader); } /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowDelete.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowDelete.cs index d9c5282c..4ed8e4f9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowDelete.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowDelete.cs @@ -9,7 +9,6 @@ using System; using System.Data.Common; using System.Globalization; using System.Linq; -using System.Threading.Tasks; using Microsoft.SqlTools.ServiceLayer.EditData.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; @@ -71,11 +70,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement /// Reader returned from the execution of the command to insert a new row. Should NOT /// contain any rows. /// - public override Task ApplyChanges(DbDataReader dataReader) + public override void ApplyChanges(DbDataReader dataReader) { // Take the result set and remove the row from it AssociatedResultSet.RemoveRow(RowId); - return Task.FromResult(0); } /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowEditBase.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowEditBase.cs index 95eedc70..cc0f8ef4 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowEditBase.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowEditBase.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Data.Common; using Microsoft.Data.SqlClient; using System.Linq; -using System.Threading.Tasks; using Microsoft.SqlTools.ServiceLayer.EditData.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; @@ -86,7 +85,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement /// /// Data reader from execution of the command to commit the change to the db /// - public abstract Task ApplyChanges(DbDataReader dataReader); + public abstract void ApplyChanges(DbDataReader dataReader); /// /// Gets a command that will commit the change to the db diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowUpdate.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowUpdate.cs index 6029f408..a98824db 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowUpdate.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/UpdateManagement/RowUpdate.cs @@ -14,7 +14,6 @@ using Microsoft.Data.SqlClient; using System.Globalization; using System.Linq; using System.Text; -using System.Threading.Tasks; using Microsoft.SqlTools.ServiceLayer.EditData.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; @@ -74,10 +73,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement /// Reader returned from the execution of the command to update a row. Should contain /// a single row that represents all the values of the row. /// - public override Task ApplyChanges(DbDataReader dataReader) + public override void ApplyChanges(DbDataReader dataReader) { Validate.IsNotNull(nameof(dataReader), dataReader); - return AssociatedResultSet.UpdateRow(RowId, dataReader); + AssociatedResultSet.UpdateRow(RowId, dataReader); } /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs index dc8de79e..a6e91528 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs @@ -12,8 +12,6 @@ using System.Data.SqlTypes; using System.Diagnostics; using System.IO; using System.Linq; -using System.Threading; -using System.Threading.Tasks; using System.Xml; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; using Microsoft.SqlTools.Utility; @@ -83,17 +81,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage #region DbDataReader Methods - /// - /// Pass-through to DbDataReader.ReadAsync() - /// - /// The cancellation token to use for cancelling a query - /// - [Obsolete("Deprecated due to performance issues, please use Read() instead.")] - public Task ReadAsync(CancellationToken cancellationToken) - { - return DbDataReader.ReadAsync(cancellationToken); - } - /// /// Pass-through to DbDataReader.Read() /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs index 19406c85..250a7d34 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs @@ -449,10 +449,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// Adds a new row to the result set by reading the row from the provided db data reader /// /// The result of a command to insert a new row should be UNREAD - public async Task AddRow(DbDataReader dbDataReader) + public void AddRow(DbDataReader dbDataReader) { // Write the new row to the end of the file - long newOffset = await AppendRowToBuffer(dbDataReader); + long newOffset = AppendRowToBuffer(dbDataReader); // Add the row to file offset list fileOffsets.Add(newOffset); @@ -464,10 +464,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// /// /// - public async Task UpdateRow(long rowId, DbDataReader dbDataReader) + public void UpdateRow(long rowId, DbDataReader dbDataReader) { // Write the updated row to the end of the file - long newOffset = await AppendRowToBuffer(dbDataReader); + long newOffset = AppendRowToBuffer(dbDataReader); // Update the file offset of the row in question fileOffsets[rowId] = newOffset; @@ -782,7 +782,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// /// An UNREAD db data reader /// The offset into the file where the row was inserted - private async Task AppendRowToBuffer(DbDataReader dbDataReader) + private long AppendRowToBuffer(DbDataReader dbDataReader) { Validate.IsNotNull(nameof(dbDataReader), dbDataReader); // Sanity check to make sure that results read has started @@ -793,11 +793,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution // NOTE: We are no longer checking to see if the data reader has rows before reading // b/c of a quirk in SqlClient. In some scenarios, a SqlException isn't thrown until we // read. In order to get appropriate errors back to the user, we'll read first. - // Returning false from .ReadAsync means there aren't any rows. + // Returning false from .Read means there aren't any rows. // Create a storage data reader, read it, make sure there were results var dataReader = new StorageDataReader(dbDataReader); - if (!await dataReader.ReadAsync(CancellationToken.None)) + if (!dataReader.Read()) { throw new InvalidOperationException(SR.QueryServiceResultSetAddNoRows); } diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Connection/ConnectionServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Connection/ConnectionServiceTests.cs index 89af4576..33eb96ee 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Connection/ConnectionServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Connection/ConnectionServiceTests.cs @@ -1498,7 +1498,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection } [Test] - public async Task GetOrOpenNullOwnerUri([Values(null, "")] string ownerUri) + public void GetOrOpenNullOwnerUri([Values(null, "")] string ownerUri) { // If: I have a connection service and I ask for a connection with an invalid ownerUri // Then: An exception should be thrown @@ -1508,7 +1508,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection } [Test] - public async Task GetOrOpenNullConnectionType([Values(null, "")] string connType) + public void GetOrOpenNullConnectionType([Values(null, "")] string connType) { // If: I have a connection service and I ask for a connection with an invalid connectionType // Then: An exception should be thrown @@ -1518,7 +1518,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection } [Test] - public async Task GetOrOpenNoConnection() + public void GetOrOpenNoConnection() { // If: I have a connection service and I ask for a connection for an unconnected uri // Then: An exception should be thrown @@ -1528,7 +1528,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection } [Test] - public async Task GetOrOpenNoDefaultConnection() + public void GetOrOpenNoDefaultConnection() { // Setup: Create a connection service with an empty connection info obj var service = TestObjects.GetTestConnectionService(); @@ -1542,7 +1542,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection } [Test] - public async Task GetOrOpenAdminDefaultConnection() + public void GetOrOpenAdminDefaultConnection() { // Setup: Create a connection service with an empty connection info obj var service = TestObjects.GetTestConnectionService(); @@ -1883,7 +1883,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection /// Verify that providing an empty password to change password will fire an error. /// [Test] - public async Task ConnectionEmptyPasswordChange() + public void ConnectionEmptyPasswordChange() { var serviceHostMock = new Mock(); @@ -1905,7 +1905,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection /// Verify that providing an invalid connection parameter value to change password will fire an error. /// [Test] - public async Task ConnectionInvalidParamPasswordChange() + public void ConnectionInvalidParamPasswordChange() { var serviceHostMock = new Mock(); @@ -1927,7 +1927,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection /// Verify that providing a non actual connection and a fake password to change password will throw an error. /// [Test] - public async Task InvalidConnectionPasswordChange() + public void InvalidConnectionPasswordChange() { var serviceHostMock = new Mock(); diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowCreateTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowCreateTests.cs index 438338f5..136fb5e2 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowCreateTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowCreateTests.cs @@ -180,7 +180,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData // If: I ask for the change to be applied var rc = new RowCreate(rowId, rs, data.TableMetadata); - await rc.ApplyChanges(newRowReader); + rc.ApplyChanges(newRowReader); // Then: The result set should have an additional row in it Assert.AreEqual(2, rs.RowCount); diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowDeleteTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowDeleteTests.cs index c8e2b4e7..44a98013 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowDeleteTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowDeleteTests.cs @@ -69,7 +69,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData // If: I ask for the change to be applied RowDelete rd = new RowDelete(0, rs, data.TableMetadata); - await rd.ApplyChanges(null); // Reader not used, can be null + rd.ApplyChanges(null); // Reader not used, can be null // Then : The result set should have one less row in it Assert.AreEqual(0, rs.RowCount); @@ -209,7 +209,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData }; var testResultSet = new TestResultSet(data.DbColumns, rows); var newRowReader = new TestDbDataReader(new[] { testResultSet }, false); - await ru.ApplyChanges(newRowReader); + ru.ApplyChanges(newRowReader); // ... Create a row delete. RowDelete rd = new RowDelete(0, rs, data.TableMetadata); diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowEditBaseTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowEditBaseTests.cs index 953890dd..8e37192a 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowEditBaseTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowEditBaseTests.cs @@ -349,7 +349,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData throw new NotImplementedException(); } - public override Task ApplyChanges(DbDataReader reader) + public override void ApplyChanges(DbDataReader reader) { throw new NotImplementedException(); } diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowUpdateTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowUpdateTests.cs index e359c31d..b7f8dbfb 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowUpdateTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/RowUpdateTests.cs @@ -403,7 +403,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData var newRowReader = Common.GetNewRowDataReader(data.DbColumns, includeIdentity); // If: I ask for the change to be applied - await ru.ApplyChanges(newRowReader); + ru.ApplyChanges(newRowReader); // Then: // ... The result set should have the same number of rows as before @@ -422,7 +422,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData // If: I ask for the changes to be applied with a null db reader // Then: I should get an exception - Assert.ThrowsAsync(() => ru.ApplyChanges(null)); + Assert.Throws(() => ru.ApplyChanges(null)); } #endregion diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/ServiceIntegrationTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/ServiceIntegrationTests.cs index ba7756fb..8ca5101a 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/ServiceIntegrationTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/ServiceIntegrationTests.cs @@ -269,7 +269,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData #region Initialize Tests [Test] [Sequential] - public async Task InitializeNullParams([Values(null, Common.OwnerUri, Common.OwnerUri)] string ownerUri, + public void InitializeNullParams([Values(null, Common.OwnerUri, Common.OwnerUri)] string ownerUri, [Values("table", null, "table")] string objName, [Values("table", "table", null)] string objType) { diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/SessionTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/SessionTests.cs index b979a0e7..152ad33e 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/SessionTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/EditData/SessionTests.cs @@ -803,7 +803,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData #region SubSet Tests [Test] - public async Task SubsetNotInitialized() + public void SubsetNotInitialized() { // Setup: // ... Create a session without initializing @@ -1108,7 +1108,6 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData // ... Add a mock commands for fun var edit = new Mock(); edit.Setup(e => e.GetCommand(It.IsAny())).Returns(dbc => dbc.CreateCommand()); - edit.Setup(e => e.ApplyChanges(It.IsAny())).Returns(Task.FromResult(0)); s.EditCache[0] = edit.Object; // If: I commit these changes (and await completion) diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/CancelTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/CancelTests.cs index f0d32d8a..9d04d92a 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/CancelTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/CancelTests.cs @@ -120,9 +120,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution Query query = new Query(Constants.StandardQuery, ci, querySettings, MemoryFileSystem.GetFileStreamFactory()); string errorMessage = null; - Query.QueryAsyncErrorEventHandler failureCallback = async (q, e) => - { + Query.QueryAsyncErrorEventHandler failureCallback = (q, e) => { errorMessage = "Error Occured"; + return Task.CompletedTask; }; query.QueryFailed += failureCallback; diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ResultSetTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ResultSetTests.cs index ae4c3db1..5b482e52 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ResultSetTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ResultSetTests.cs @@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution } [Test] - public async Task ReadToEndNullReader() + public void ReadToEndNullReader() { // If: I create a new result set with a null db data reader // Then: I should get an exception @@ -169,8 +169,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution get { yield return new object[] {new Action(rs => rs.GetSubset(0, 0).Wait())}; - yield return new object[] {new Action(rs => rs.UpdateRow(0, null).Wait())}; - yield return new object[] {new Action(rs => rs.AddRow(null).Wait())}; + yield return new object[] {new Action(rs => rs.UpdateRow(0, null))}; + yield return new object[] {new Action(rs => rs.AddRow(null))}; yield return new object[] {new Action(rs => rs.RemoveRow(0))}; yield return new object[] {new Action(rs => rs.GetRow(0))}; yield return new object[] {new Action(rs => rs.GetExecutionPlan().Wait())}; @@ -399,7 +399,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution { yield return (rs, id) => rs.RemoveRow(id); yield return (rs, id) => rs.GetRow(id); - yield return (rs, id) => rs.UpdateRow(id, null).Wait(); + yield return (rs, id) => rs.UpdateRow(id, null); } } @@ -438,7 +438,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution // If: I add a row with a reader that has no rows // Then: // ... I should get an exception - Assert.ThrowsAsync(() => resultSet.AddRow(emptyReader)); + Assert.Throws(() => resultSet.AddRow(emptyReader)); // ... The row count should not have changed Assert.AreEqual(Common.StandardRows, resultSet.RowCount); @@ -457,7 +457,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution // ... Create a mock reader that will throw on read var throwingReader = GetReader(new[] {new TestResultSet(5, 0)}, true, Constants.StandardQuery); - Assert.ThrowsAsync(() => resultSet.AddRow(throwingReader), "I add a row with a reader that throws on read. I should get an exception"); + Assert.Throws(() => resultSet.AddRow(throwingReader), "I add a row with a reader that throws on read. I should get an exception"); // ... The row count should not have changed Assert.AreEqual(Common.StandardRows, resultSet.RowCount); @@ -480,7 +480,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution var newRowReader = GetReader(results, false, Constants.StandardQuery); // If: I add a new row to the result set - await resultSet.AddRow(newRowReader); + resultSet.AddRow(newRowReader); // Then: // ... There should be a new row in the list of rows @@ -505,7 +505,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution // If: I add a row with a reader that has no rows // Then: // ... I should get an exception - Assert.ThrowsAsync(() => resultSet.UpdateRow(0, emptyReader)); + Assert.Throws(() => resultSet.UpdateRow(0, emptyReader)); // ... The row count should not have changed Assert.AreEqual(Common.StandardRows, resultSet.RowCount); @@ -528,7 +528,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution var newRowReader = GetReader(results, false, Constants.StandardQuery); // If: I add a new row to the result set - await resultSet.UpdateRow(0, newRowReader); + resultSet.UpdateRow(0, newRowReader); // Then: // ... There should be the same number of rows diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs index 2953fd02..d186639a 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs @@ -148,7 +148,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution #region Inter-Service API Tests [Test] - public async Task InterServiceExecuteNullExecuteParams() + public void InterServiceExecuteNullExecuteParams() { // Setup: Create a query service var qes = new QueryExecutionService(null, null); @@ -162,7 +162,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution } [Test] - public async Task InterServiceExecuteNullEventSender() + public void InterServiceExecuteNullEventSender() { // Setup: Create a query service, and execute params var qes = new QueryExecutionService(null, null); @@ -175,7 +175,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution } [Test] - public async Task InterServiceDisposeNullSuccessFunc() + public void InterServiceDisposeNullSuccessFunc() { // Setup: Create a query service and dispose params var qes = new QueryExecutionService(null, null); @@ -188,7 +188,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution } [Test] - public async Task InterServiceDisposeNullFailureFunc() + public void InterServiceDisposeNullFailureFunc() { // Setup: Create a query service and dispose params var qes = new QueryExecutionService(null, null); diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/ExecutionPlanTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/ExecutionPlanTests.cs index 8abbfc75..4f8c1511 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/ExecutionPlanTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/ExecutionPlanTests.cs @@ -38,7 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution } [Test] - public async Task ExecutionPlanInvalid() + public void ExecutionPlanInvalid() { // Setup: // ... I have a batch that has been executed @@ -71,7 +71,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution } [Test] - public async Task BatchExecutionPlanInvalidTest() + public void BatchExecutionPlanInvalidTest() { // Setup: // ... I have a batch that has been executed without an execution plan @@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution } [Test] - public async Task BatchExecutionPlanInvalidParamsTest([Values(-1,2)] int resultSetIndex) + public void BatchExecutionPlanInvalidParamsTest([Values(-1,2)] int resultSetIndex) { // If I have an executed batch which has an execution plan Batch b = Common.GetExecutedBatchWithExecutionPlan(); @@ -99,7 +99,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution #region Query Class Tests [Test] - public async Task QueryExecutionPlanInvalidParamsTest([Values(-1,2)]int batchIndex) + public void QueryExecutionPlanInvalidParamsTest([Values(-1,2)]int batchIndex) { // Setup query settings QueryExecutionSettings querySettings = new QueryExecutionSettings diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/SubsetTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/SubsetTests.cs index ae99ae4c..5c7188a4 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/SubsetTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/SubsetTests.cs @@ -158,7 +158,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution } [Test] - public async Task SubsetServiceMissingQueryTest() + public void SubsetServiceMissingQueryTest() { // If: // ... I ask for a set of results for a file that hasn't executed a query diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ResourceProvider/FirewallRuleServiceTest.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ResourceProvider/FirewallRuleServiceTest.cs index 4d24d010..fdcd430e 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ResourceProvider/FirewallRuleServiceTest.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ResourceProvider/FirewallRuleServiceTest.cs @@ -24,7 +24,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider public class FirewallRuleServiceTest { [Test] - public async Task CreateShouldThrowExceptionGivenNullServerName() + public void CreateShouldThrowExceptionGivenNullServerName() { string serverName = null; @@ -34,7 +34,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionGivenNullStartIp() + public void CreateShouldThrowExceptionGivenNullStartIp() { string serverName = "serverName"; @@ -44,7 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionGivenInvalidEndIp() + public void CreateShouldThrowExceptionGivenInvalidEndIp() { string serverName = "serverName"; @@ -54,7 +54,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionGivenInvalidStartIp() + public void CreateShouldThrowExceptionGivenInvalidStartIp() { string serverName = "serverName"; @@ -64,7 +64,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionGivenNullEndIp() + public void CreateShouldThrowExceptionGivenNullEndIp() { ServiceTestContext testContext = new ServiceTestContext(); testContext.EndIpAddress = null; @@ -72,7 +72,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionIfUserIsNotLoggedIn() + public void CreateShouldThrowExceptionIfUserIsNotLoggedIn() { var applicationAuthenticationManagerMock = new Mock(); applicationAuthenticationManagerMock.Setup(x => x.GetUserNeedsReauthenticationAsync()).Throws(new ApplicationException()); @@ -89,7 +89,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionIfUserDoesNotHaveSubscriptions() + public void CreateShouldThrowExceptionIfUserDoesNotHaveSubscriptions() { var applicationAuthenticationManagerMock = new Mock(); @@ -109,7 +109,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionIfAuthenticationManagerFailsToReturnSubscription() + public void CreateShouldThrowExceptionIfAuthenticationManagerFailsToReturnSubscription() { var applicationAuthenticationManagerMock = new Mock(); applicationAuthenticationManagerMock.Setup(x => x.GetUserNeedsReauthenticationAsync()).Returns(Task.FromResult(false)); @@ -127,7 +127,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionGivenNoSubscriptionFound() + public void CreateShouldThrowExceptionGivenNoSubscriptionFound() { ServiceTestContext testContext = new ServiceTestContext(); testContext = CreateMocks(testContext); @@ -242,7 +242,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateThrowExceptionIfResourceNotFound() + public void CreateThrowExceptionIfResourceNotFound() { ServiceTestContext testContext = new ServiceTestContext(); var resources = new List @@ -258,7 +258,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateThrowExceptionIfResourcesIsEmpty() + public void CreateThrowExceptionIfResourcesIsEmpty() { ServiceTestContext testContext = new ServiceTestContext(); @@ -269,7 +269,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider } [Test] - public async Task CreateShouldThrowExceptionIfThereIsNoSubscriptionForUser() + public void CreateShouldThrowExceptionIfThereIsNoSubscriptionForUser() { ServiceTestContext testContext = new ServiceTestContext(); testContext.Subscriptions = new List(); @@ -281,7 +281,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ResourceProvider [Test] - public async Task CreateShouldThrowExceptionIfSubscriptionIsInAnotherAccount() + public void CreateShouldThrowExceptionIfSubscriptionIsInAnotherAccount() { ServiceTestContext testContext = new ServiceTestContext(); testContext.Subscriptions = new List