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 Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
using NUnit.Framework;
using Microsoft.Data.SqlClient;
@@ -27,7 +29,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
public void CacheMatchesNullDbNameToEmptyString()
{
// Set sqlDw result into cache
string dataSource = "testDataSource";
string dataSource = "testDataSource";
SqlConnectionStringBuilder testSource = new SqlConnectionStringBuilder
{
DataSource = dataSource,
@@ -70,10 +72,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
cache.AddOrUpdateCache(testSource, state, CachedServerInfo.CacheVariable.EngineEdition);
Assert.Multiple(() =>
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown) );
Assert.That(engineEdition, Is.EqualTo(state), "Expect the same returned result");
Assert.Multiple(() =>
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown) );
Assert.That(engineEdition, Is.EqualTo(state), "Expect the same returned result");
});
}
@@ -89,9 +91,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
cache.AddOrUpdateCache(testSource, state, CachedServerInfo.CacheVariable.EngineEdition);
Assert.Multiple(() =>
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown));
Assert.That(engineEdition, Is.EqualTo(state), "Expect the same returned result");
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown));
Assert.That(engineEdition, Is.EqualTo(state), "Expect the same returned result");
});
DatabaseEngineEdition newState = state == DatabaseEngineEdition.SqlDataWarehouse ?
@@ -100,9 +102,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
cache.AddOrUpdateCache(testSource, newState, CachedServerInfo.CacheVariable.EngineEdition);
Assert.Multiple(() =>
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown));
Assert.That(engineEdition, Is.EqualTo(newState), "Expect the opposite returned result");
{
Assert.That(cache.TryGetEngineEdition(testSource, out engineEdition), Is.Not.EqualTo(DatabaseEngineEdition.Unknown));
Assert.That(engineEdition, Is.EqualTo(newState), "Expect the opposite returned result");
});
}
@@ -150,7 +152,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
[Test]
public void AskforEngineEditionBeforeCached()
{
{
Assert.AreEqual(DatabaseEngineEdition.Unknown, cache.TryGetEngineEdition(new SqlConnectionStringBuilder
{
DataSource = "testDataSourceUnCached"