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 NUnit.Framework;
using Microsoft.SqlTools.ServiceLayer.Management;

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 NUnit.Framework;
[assembly: NonParallelizable]

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.Collections.Generic;
using System.Data.Common;

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.Threading;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;

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.LanguageServices;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;

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"

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.Linq;
using Microsoft.SqlTools.Hosting.Contracts;
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;

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.Data.SqlClient;
using Microsoft.SqlTools.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.Admin.Contracts;

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;
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
using Moq;

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;
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;

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.IO;
using System.Runtime.InteropServices;

View File

@@ -3,11 +3,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Credentials;
using Microsoft.SqlTools.Credentials.Linux;
using Microsoft.SqlTools.ServiceLayer.Test.Common;
using NUnit.Framework;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Linux
{
[TestFixture]

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.Utility;
using NUnit.Framework;

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 Microsoft.SqlTools.Credentials.Win32;
using Microsoft.SqlTools.ServiceLayer.Test.Common;

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 Microsoft.SqlTools.Credentials.Win32;
using Microsoft.SqlTools.ServiceLayer.Test.Common;

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 Microsoft.SqlTools.ServiceLayer.DacFx;
using NUnit.Framework;

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.DisasterRecovery;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
using Microsoft.SqlTools.ServiceLayer.Management;

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.DisasterRecovery;
using Microsoft.SqlTools.ServiceLayer.TaskServices;
using Moq;

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 Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation;

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.DisasterRecovery;
using NUnit.Framework;

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.DisasterRecovery.Contracts;
using NUnit.Framework;

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.Collections.Generic;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;

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.Collections.Generic;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;

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 Moq;
using NUnit.Framework;

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.Collections.Generic;
using System.Data.Common;
@@ -185,32 +187,32 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
Assert.Throws<InvalidOperationException>(() => new CellUpdate(col, value));
}
/// <summary>
/// Not using TestCaseSource because nUnit's test name generator
/// doesn't like DbColumnWrapper objects as a source, due
/// to that class lacking a ToString override.
/// </summary>
/// <param name="col"></param>
/// <summary>
/// Not using TestCaseSource because nUnit's test name generator
/// doesn't like DbColumnWrapper objects as a source, due
/// to that class lacking a ToString override.
/// </summary>
/// <param name="col"></param>
/// <param name="obj"></param>
[Test]
public void RoundTripTest()
{
foreach (var inputs in RoundTripTestParams)
{
var col = (DbColumnWrapper)inputs[0];
var obj = inputs[1];
// Setup: Figure out the test string
string testString = obj.ToString();
// If: I attempt to create a CellUpdate
CellUpdate cu = new CellUpdate(col, testString);
// Then: The value and type should match what we put in
Assert.That(cu.Value, Is.InstanceOf(col.DataType));
Assert.AreEqual(obj, cu.Value);
Assert.AreEqual(testString, cu.ValueAsString);
Assert.AreEqual(col, cu.Column);
foreach (var inputs in RoundTripTestParams)
{
var col = (DbColumnWrapper)inputs[0];
var obj = inputs[1];
// Setup: Figure out the test string
string testString = obj.ToString();
// If: I attempt to create a CellUpdate
CellUpdate cu = new CellUpdate(col, testString);
// Then: The value and type should match what we put in
Assert.That(cu.Value, Is.InstanceOf(col.DataType));
Assert.AreEqual(obj, cu.Value);
Assert.AreEqual(testString, cu.ValueAsString);
Assert.AreEqual(col, cu.Column);
}
}

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.Collections.Generic;
using System.Data.Common;
using System.Linq;

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 Microsoft.SqlTools.ServiceLayer.EditData.Contracts;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;

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.EditData;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using Microsoft.SqlTools.ServiceLayer.UnitTests.Utility;

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.Collections.Generic;
using System.Data.Common;
@@ -335,11 +337,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
string[] outCols = insertMatch.Groups[2].Value.Split(", ");
Assert.AreEqual(expectedOutput.ExpectedOutColumns, outCols.Length);
Assert.That(outCols, Has.All.StartsWith("inserted."), "Output columns match");
Assert.Multiple(() =>
{
Assert.That(insertMatch.Groups[3].Value, Does.StartWith("Insert"), "Output table name matches");
Assert.That(insertMatch.Groups[3].Value, Does.EndWith("Output"));
Assert.Multiple(() =>
{
Assert.That(insertMatch.Groups[3].Value, Does.StartWith("Insert"), "Output table name matches");
Assert.That(insertMatch.Groups[3].Value, Does.EndWith("Output"));
});
}
else
@@ -355,19 +357,19 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
//
string[] outCols = insertMatch.Groups[3].Value.Split(", ");
Assert.Multiple(() =>
{
Assert.AreEqual(expectedOutput.ExpectedOutColumns, outCols.Length);
Assert.That(outCols, Has.All.StartsWith("inserted."), "Output columns match");
{
Assert.AreEqual(expectedOutput.ExpectedOutColumns, outCols.Length);
Assert.That(outCols, Has.All.StartsWith("inserted."), "Output columns match");
});
// In columns match
string[] inCols = insertMatch.Groups[2].Value.Split(", ");
Assert.AreEqual(expectedOutput.ExpectedInColumns, inCols.Length);
// Output table name matches
Assert.Multiple(() =>
{
Assert.That(insertMatch.Groups[4].Value, Does.StartWith("Insert"));
Assert.AreEqual(expectedOutput.ExpectedInColumns, inCols.Length);
// Output table name matches
Assert.Multiple(() =>
{
Assert.That(insertMatch.Groups[4].Value, Does.StartWith("Insert"));
Assert.That(insertMatch.Groups[4].Value, Does.EndWith("Output"));
});
@@ -469,9 +471,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
Assert.AreEqual(rc.newCells.Length, er.Cells.Length);
Assert.AreEqual(SR.EditDataComputedColumnPlaceholder, er.Cells[0].DisplayValue);
Assert.False(er.Cells[0].IsNull);
Assert.True(er.Cells[0].IsDirty);
// ... The rest of the cells should have empty display values
Assert.True(er.Cells[0].IsDirty);
// ... The rest of the cells should have empty display values
Assert.That(er.Cells.Skip(1).Select(ec => new { ec.DisplayValue, ec.IsNull, ec.IsDirty }), Has.All.EqualTo(new { DisplayValue = string.Empty, IsNull = false, IsDirty = true }));
}

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;

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.Collections.Generic;
using System.Data.Common;

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;
@@ -296,8 +298,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
string[] setCols = updateMatch.Groups[2].Value.Split(", ");
Assert.AreEqual(3, setCols.Length);
Assert.That(setCols, Has.All.Match(@".+ = @Value\d+_\d+"), "Set columns match");
// Output table name matches
// Output table name matches
Assert.That(updateMatch.Groups[4].Value, Does.StartWith("Update"));
Assert.That(updateMatch.Groups[4].Value, Does.EndWith("Output"));

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))]

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.Collections.Generic;
using System.Data.Common;

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.Composition;
using System.Linq;

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 Microsoft.SqlTools.Extensibility;

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 Microsoft.SqlTools.ServiceLayer.FileBrowser;
using Microsoft.SqlTools.ServiceLayer.FileBrowser.Contracts;

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.Formatter;
using NUnit.Framework;
@@ -11,9 +13,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
public class BinaryQueryExpressionFormatterTests : FormatterUnitTestsBase
{
[SetUp]
public void Init()
{
InitFormatterUnitTestsBase();
public void Init()
{
InitFormatterUnitTestsBase();
}
[Test]

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.Formatter;
using NUnit.Framework;

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.Formatter;
using NUnit.Framework;

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.Formatter;
using NUnit.Framework;

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.Formatter;
using NUnit.Framework;

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.Formatter;
using Microsoft.SqlTools.ServiceLayer.Formatter.Contracts;
using Microsoft.SqlTools.ServiceLayer.SqlContext;

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.IO;
using System.Reflection;
using Microsoft.SqlTools.Hosting.Protocol;

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.Formatter;
using NUnit.Framework;

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.Formatter;
using NUnit.Framework;

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.Formatter;
using NUnit.Framework;

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.Text;
using System.Threading;

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.LanguageExtensibility;
using Microsoft.SqlTools.ServiceLayer.LanguageExtensibility.Contracts;
using Microsoft.SqlTools.ServiceLayer.Test.Common;

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.Threading.Tasks;
using Microsoft.SqlServer.Management.SqlParser.Parser;
using Microsoft.SqlTools.Hosting.Protocol;

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.Threading;
using Microsoft.SqlServer.Management.Common;

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.Collections.Generic;
using System.Linq;
using System.Threading;

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.Collections.Generic;
using NUnit.Framework;

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.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.SqlServer.Management.SqlParser.Binder;

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.LanguageServices;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;

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.IO;
using System.Runtime.InteropServices;

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 Microsoft.SqlServer.Management.SqlParser.Intellisense;

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.Text;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Messaging

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.Diagnostics;
using System.Threading;

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.IO;
using System.Text;

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.IO;
using System.Text;
using System.Threading.Tasks;

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.Threading.Tasks;
using Microsoft.SqlTools.Hosting.Protocol;

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 NUnit.Framework;
using Microsoft.SqlTools.ServiceLayer.NotebookConvert;
using Newtonsoft.Json;

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.Collections.Generic;
using Microsoft.SqlServer.Management.Smo;

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.Collections.Generic;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;

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.Collections.Generic;
using Microsoft.Data.SqlClient;

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 Microsoft.Data.SqlClient;
using System.Linq;

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.Extensibility;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer;

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.Contracts;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer;
using NUnit.Framework;

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 Microsoft.SqlServer.Management.Smo;

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.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel;
using NUnit.Framework;

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.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;

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.Threading;
using Microsoft.SqlTools.ServiceLayer.Profiler;

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.Collections.Generic;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.Profiler;

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.Reflection;
using System.Runtime.InteropServices;

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.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;

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.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;

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.IO;
using System.Linq;

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.Collections.Generic;
using System.IO;

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.Collections.Generic;
using System.IO;

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.IO;
using System.Text;

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.Collections.Generic;
using System.Data.SqlTypes;
@@ -157,10 +159,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
public void Int16([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue // Negative two byte number
)] short value)
{
@@ -169,10 +171,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Int32([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue, // Negative two byte number
int.MaxValue, // Four byte number
int.MinValue // Negative four byte number
@@ -183,10 +185,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Int64([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue, // Negative two byte number
int.MaxValue, // Four byte number
int.MinValue, // Negative four byte number
@@ -236,12 +238,12 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Single([Values(
0,
10.1F,
-10.1F,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
0,
10.1F,
-10.1F,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
float.NegativeInfinity
)] float value)
{
@@ -250,16 +252,16 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Double([Values(
0,
10.1,
-10.1,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
0,
10.1,
-10.1,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
float.NegativeInfinity,
double.PositiveInfinity,
double.NegativeInfinity,
double.MinValue,
double.PositiveInfinity,
double.NegativeInfinity,
double.MinValue,
double.MaxValue
)]double value)
{
@@ -577,11 +579,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void GuidTest()
{
foreach (var testValue in GuidTestParameters)
{
VerifyReadWrite(testValue.ToByteArray().Length + 1, testValue,
(writer, val) => writer.WriteGuid(testValue),
(reader, rowId) => reader.ReadGuid(0, rowId));
foreach (var testValue in GuidTestParameters)
{
VerifyReadWrite(testValue.ToByteArray().Length + 1, testValue,
(writer, val) => writer.WriteGuid(testValue),
(reader, rowId) => reader.ReadGuid(0, rowId));
}
}

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 Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using NUnit.Framework;

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.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;

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.Collections.Generic;
using System.Data;

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.Data.Common;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using NUnit.Framework;

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.Collections.Generic;
using System.Linq;

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.Collections.Concurrent;
using System.Collections.Generic;

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.Collections.Concurrent;
using System.Collections.Generic;

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;

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.Collections.Generic;
using System.Data.Common;

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.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;

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.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;

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.QueryExecution;
using NUnit.Framework;

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));
}

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.Collections.Generic;
using System.Linq;

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.Collections.Generic;
using System.Globalization;

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.Azure.Management.Sql.Models;
using Microsoft.SqlTools.ResourceProvider.DefaultImpl;
using NUnit.Framework;

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.Collections.Generic;
using System.Linq;

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 Microsoft.SqlTools.ResourceProvider.DefaultImpl;
using NUnit.Framework;

Some files were not shown because too many files have changed in this diff Show More