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.Data.Common;
using System.Linq;
@@ -283,8 +285,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
ObjectType = objType
};
var contextMock = RequestContextMocks.Create<EditInitializeResult>(null);
// ... And I initialize an edit session with that
// Then:
// ... And I initialize an edit session with that
// Then:
// ... An error event should have been sent
Assert.That(() => eds.HandleInitializeRequest(initParams, contextMock.Object), Throws.ArgumentException);
@@ -308,13 +310,13 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
ObjectType = "Table",
Filters = new EditInitializeFiltering()
};
var contextMock = RequestContextMocks.Create<EditInitializeResult>(null);
// Then:
// ... An error event should have been sent
Assert.That(() => eds.HandleInitializeRequest(initParams, contextMock.Object), Throws.ArgumentNullException);
// ... The original session should still be there
var contextMock = RequestContextMocks.Create<EditInitializeResult>(null);
// Then:
// ... An error event should have been sent
Assert.That(() => eds.HandleInitializeRequest(initParams, contextMock.Object), Throws.ArgumentNullException);
// ... The original session should still be there
Assert.AreEqual(1, eds.ActiveSessions.Count);
Assert.AreEqual(session, eds.ActiveSessions[Constants.OwnerUri]);
}
@@ -378,15 +380,15 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
// ... The session should have been created
Assert.AreEqual(1, eds.ActiveSessions.Count);
Assert.True(eds.ActiveSessions.Keys.Contains(Constants.OwnerUri));
}
}
#endregion
private static readonly object[] schemaNameParameters =
{
private static readonly object[] schemaNameParameters =
{
new object[] {"table", "myschema", new[] { "myschema", "table" } }, // Use schema
new object[] {"table", null, new[] { "table" } }, // skip schema
new object[] {"schema.table", "myschema", new[] { "myschema", "schema.table" } }, // Use schema
new object[] {"schema.table", null, new[] { "schema", "table" } }, // Split object name into schema
new object[] {"schema.table", null, new[] { "schema", "table" } }, // Split object name into schema
};
[Test, TestCaseSource(nameof(schemaNameParameters))]