Make nullable warnings a per file opt-in (#1842)

* Make nullable warnings a per file opt-in

* Remove unneeded compiler directives

* Remove compiler directive for User Data
This commit is contained in:
Karl Burtram
2023-02-03 18:10:07 -08:00
committed by GitHub
parent 735517a503
commit f288bee294
1020 changed files with 2299 additions and 273 deletions

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Linq;
using System.Threading.Tasks;
@@ -19,11 +21,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
{
#region ResultSet Class Tests
static private readonly object[] validSet =
{
static private readonly object[] validSet =
{
new object[] {0, 2 },
new object[] {0, 20 },
new object[] {1, 2 },
new object[] {1, 2 },
};
[Test, TestCaseSource(nameof(validSet))]
@@ -46,14 +48,14 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
Assert.AreEqual(Math.Min(rowCount, Common.StandardRows), subset.Rows.Length);
}
static private readonly object[] invalidSet =
static private readonly object[] invalidSet =
{
new object[] {-1, 2}, // Invalid start index, too low
new object[] {10, 2}, // Invalid start index, too high
new object[] {0, -1}, // Invalid row count, too low
new object[] {0, 0 }, // Invalid row count, zero
new object[] {0, 0 }, // Invalid row count, zero
};
[Test, TestCaseSource(nameof(invalidSet))]
[Test, TestCaseSource(nameof(invalidSet))]
public void ResultSetInvalidParmsTest(int rowStartIndex, int rowCount)
{
// If:
@@ -163,7 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
var workspaceService = Common.GetPrimedWorkspaceService(Constants.StandardQuery);
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
var subsetParams = new SubsetParams { OwnerUri = Constants.OwnerUri, RowsCount = 1, ResultSetIndex = 0, RowsStartIndex = 0 };
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => queryService.HandleResultSubsetRequest(subsetParams, contextMock.Object));
}
@@ -202,7 +204,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
// ... And I then ask for a set of results from it
var subsetParams = new SubsetParams { OwnerUri = Constants.OwnerUri, RowsCount = 1, ResultSetIndex = 0, RowsStartIndex = 0 };
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => queryService.HandleResultSubsetRequest(subsetParams, contextMock.Object));
}