mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 01:25:41 -05:00
Convert most tools service tests to nunit (#1037)
* Remove xunit dependency from testdriver * swap expected/actual as needed * Convert Test.Common to nunit * port hosting unit tests to nunit * port batchparser integration tests to nunit * port testdriver.tests to nunit * fix target to copy dependency * port servicelayer unittests to nunit * more unit test fixes * port integration tests to nunit * fix test method type * try using latest windows build for PRs * reduce test memory use
This commit is contained in:
@@ -10,7 +10,7 @@ using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using Moq;
|
||||
using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin.Contracts;
|
||||
@@ -44,8 +44,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
||||
/// <summary>
|
||||
/// Validate creating a database with valid input
|
||||
/// </summary>
|
||||
// [Fact]
|
||||
public async void CreateDatabaseWithValidInputTest()
|
||||
// [Test]
|
||||
public async Task CreateDatabaseWithValidInputTest()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
var requestContext = new Mock<RequestContext<CreateDatabaseResponse>>();
|
||||
@@ -68,8 +68,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
||||
/// <summary>
|
||||
/// Get a default database info object
|
||||
/// </summary>
|
||||
// [Fact]
|
||||
public async void GetDefaultDatebaseInfoTest()
|
||||
// [Test]
|
||||
public async Task GetDefaultDatebaseInfoTest()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
var requestContext = new Mock<RequestContext<DefaultDatabaseInfoResponse>>();
|
||||
@@ -89,8 +89,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
||||
/// Get database info test
|
||||
/// </summary>
|
||||
/// Test is failing in code coverage runs. Reenable when stable.
|
||||
/// [Fact]
|
||||
public async void GetDatabaseInfoTest()
|
||||
/// [Test]
|
||||
public async Task GetDatabaseInfoTest()
|
||||
{
|
||||
var results = GetLiveAutoCompleteTestObjects();
|
||||
var requestContext = new Mock<RequestContext<GetDatabaseInfoResponse>>();
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify default agent/alerts handlers
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentAlertsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -42,7 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "create agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentAlertsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -86,7 +86,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "update agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentAlertsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentJobStepRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentJobStepRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleUpdateAgentJobStepRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentJobStepRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -71,7 +71,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleDeleteAgentJobRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteAgentJobStepRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentJobRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentJobRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleUpdateAgentJobRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentJobRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -66,7 +66,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleDeleteAgentJobRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteAgentJobRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -86,7 +86,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestAgentJobDefaultsRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestAgentJobDefaultsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -8,7 +8,7 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -17,7 +17,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Test case for fetch notebook jobs Request Handler
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentNotebooksRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -40,16 +40,16 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Tests the create job helper function
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestAgentNotebookCreateHelper()
|
||||
[Test]
|
||||
public async Task TestAgentNotebookCreateHelper()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
|
||||
AgentNotebookInfo notebook = AgentTestUtils.GetTestNotebookInfo("myTestNotebookJob" + Guid.NewGuid().ToString(), "master");
|
||||
Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
notebook = AgentTestUtils.SetupNotebookJob(connectionResult).Result;
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
await AgentTestUtils.CleanupNotebookJob(connectionResult, notebook);
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Tests the create job request handler with an invalid file path
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestHandleCreateAgentNotebookRequestWithInvalidTemplatePath()
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentNotebookRequestWithInvalidTemplatePath()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -75,15 +75,15 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
}, createNotebookContext.Object);
|
||||
|
||||
createNotebookContext.Verify(x => x.SendResult(It.Is<CreateAgentNotebookResult>(p => p.Success == false)));
|
||||
Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// creating a job with duplicate name
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestDuplicateJobCreation()
|
||||
[Test]
|
||||
public async Task TestDuplicateJobCreation()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -114,8 +114,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Tests the create notebook job handler
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestCreateAgentNotebookHandler()
|
||||
[Test]
|
||||
public async Task TestCreateAgentNotebookHandler()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -131,7 +131,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
TemplateFilePath = AgentTestUtils.CreateTemplateNotebookFile()
|
||||
}, createNotebookContext.Object);
|
||||
createNotebookContext.Verify(x => x.SendResult(It.Is<CreateAgentNotebookResult>(p => p.Success == true)));
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
var createdNotebook = AgentTestUtils.GetNotebook(connectionResult, notebook.Name);
|
||||
await AgentTestUtils.CleanupNotebookJob(connectionResult, createdNotebook);
|
||||
}
|
||||
@@ -140,8 +140,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Tests the delete notebook job handler
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestDeleteAgentNotebookHandler()
|
||||
[Test]
|
||||
public async Task TestDeleteAgentNotebookHandler()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
//creating a notebook job
|
||||
AgentNotebookInfo notebook = AgentTestUtils.SetupNotebookJob(connectionResult).Result;
|
||||
//verifying it's getting created
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
//deleting the notebook job
|
||||
var deleteNotebookContext = new Mock<RequestContext<ResultStatus>>();
|
||||
deleteNotebookContext.Setup(x => x.SendResult(It.IsAny<ResultStatus>())).Returns(Task.FromResult(new object()));
|
||||
@@ -161,15 +161,15 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
}, deleteNotebookContext.Object);
|
||||
deleteNotebookContext.Verify(x => x.SendResult(It.Is<ResultStatus>(p => p.Success == true)));
|
||||
//verifying if the job is deleted
|
||||
Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// deleting a existing notebook job
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestDeleteNonExistentJob()
|
||||
[Test]
|
||||
public async Task TestDeleteNonExistentJob()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -193,8 +193,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// updating a non existing notebook job
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestUpdateNonExistentJob()
|
||||
[Test]
|
||||
public async Task TestUpdateNonExistentJob()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -219,8 +219,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// update notebook handler with garbage path
|
||||
/// </summary>
|
||||
[Fact]
|
||||
internal async Task TestUpdateWithGarbagePath()
|
||||
[Test]
|
||||
public async Task TestUpdateWithGarbagePath()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -230,7 +230,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
//seting up a temp notebook job
|
||||
var notebook = AgentTestUtils.SetupNotebookJob(connectionResult).Result;
|
||||
//verifying that the notebook is created
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
|
||||
var updateNotebookContext = new Mock<RequestContext<UpdateAgentNotebookResult>>();
|
||||
updateNotebookContext.Setup(x => x.SendResult(It.IsAny<UpdateAgentNotebookResult>())).Returns(Task.FromResult(new object()));
|
||||
@@ -246,12 +246,12 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
|
||||
//cleaning up the job
|
||||
await AgentTestUtils.CleanupNotebookJob(connectionResult, notebook);
|
||||
Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
internal async Task TestDeletingUpdatedJob()
|
||||
[Test]
|
||||
public async Task TestDeletingUpdatedJob()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -261,13 +261,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
//seting up a temp notebook job
|
||||
var notebook = AgentTestUtils.SetupNotebookJob(connectionResult).Result;
|
||||
//verifying that the notebook is created
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
|
||||
var originalName = notebook.Name;
|
||||
//Changing the notebookName
|
||||
notebook.Name = "myTestNotebookJob" + Guid.NewGuid().ToString();
|
||||
|
||||
Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
|
||||
await AgentNotebookHelper.UpdateNotebook(
|
||||
service,
|
||||
@@ -278,7 +278,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
ManagementUtils.asRunType(0)
|
||||
);
|
||||
|
||||
Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
Assert.AreEqual(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook));
|
||||
|
||||
//cleaning up the job
|
||||
await AgentTestUtils.CleanupNotebookJob(connectionResult, notebook);
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify default agent/operators handlers
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentOperatorsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -41,7 +41,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "create agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentOperatorRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -63,7 +63,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleUpdateAgentOperatorRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentOperatorRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -87,7 +87,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleDeleteAgentOperatorRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteAgentOperatorRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.SqlTools.ServiceLayer.Security.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
@@ -24,7 +24,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify default agent/proxies handlers
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentProxiesRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentProxyRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentProxyRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -69,7 +69,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "update agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentProxyRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -96,7 +96,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleDeleteAgentProxyRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteAgentProxyRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// HandleAgentSchedulesRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task HandleAgentSchedulesRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentScheduleRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateAgentScheduleRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -69,7 +69,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleUpdateAgentScheduleRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateAgentScheduleRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -95,7 +95,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// TestHandleDeleteAgentScheduleRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteAgentScheduleRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify that a start profiling request starts a profiling session
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentJobsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify that a job history request returns the job history
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleJobHistoryRequests()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -65,7 +65,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleAgentJobActionRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
[assembly: CollectionBehavior(DisableTestParallelization = true)]
|
||||
[assembly: NonParallelizable]
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Cms
|
||||
{
|
||||
@@ -37,8 +37,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Cms
|
||||
return connectParams;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
private async void TestAddCMS()
|
||||
[Test]
|
||||
public async Task TestAddCMS()
|
||||
{
|
||||
string name = "TestAddCMS" + DateTime.Now.ToString();
|
||||
ConnectParams connectParams = CreateConnectParams();
|
||||
@@ -63,8 +63,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Cms
|
||||
requestContext.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
private async void TestAddRemoveRegisteredServer()
|
||||
[Test]
|
||||
public async Task TestAddRemoveRegisteredServer()
|
||||
{
|
||||
string name = "TestAddRemoveRegisteredServer" + DateTime.Now.ToString();
|
||||
ConnectParams connectParams = await CreateAndConnectWithConnectParams();
|
||||
@@ -122,8 +122,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Cms
|
||||
requestContext3.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
private async void TestAddRemoveServerGroup()
|
||||
[Test]
|
||||
public async Task TestAddRemoveServerGroup()
|
||||
{
|
||||
string name = "TestAddRemoveServerGroup" + DateTime.Now.ToString();
|
||||
ConnectParams connectParams = await CreateAndConnectWithConnectParams();
|
||||
@@ -174,8 +174,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Cms
|
||||
requestContext3.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
private async void TestAddRemoveNestedGroup()
|
||||
[Test]
|
||||
public async Task TestAddRemoveNestedGroup()
|
||||
{
|
||||
string name = "TestAddRemoveNestedGroup" + DateTime.Now.ToString();
|
||||
ConnectParams connectParams = await CreateAndConnectWithConnectParams();
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// </summary>
|
||||
public class ConnectionServiceTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RunningMultipleQueriesCreatesOnlyOneConnection()
|
||||
{
|
||||
// Connect/disconnect twice to ensure reconnection can occur
|
||||
@@ -34,8 +34,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
string uri = connectionInfo.OwnerUri;
|
||||
|
||||
// We should see one ConnectionInfo and one DbConnection
|
||||
Assert.Equal(1, connectionInfo.CountConnections);
|
||||
Assert.Equal(1, service.OwnerToConnectionMap.Count);
|
||||
Assert.AreEqual(1, connectionInfo.CountConnections);
|
||||
Assert.AreEqual(1, service.OwnerToConnectionMap.Count);
|
||||
|
||||
// If we run a query
|
||||
var fileStreamFactory = MemoryFileSystem.GetFileStreamFactory();
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
query.ExecutionTask.Wait();
|
||||
|
||||
// We should see two DbConnections
|
||||
Assert.Equal(2, connectionInfo.CountConnections);
|
||||
Assert.AreEqual(2, connectionInfo.CountConnections);
|
||||
|
||||
// If we run another query
|
||||
query = new Query(Constants.StandardQuery, connectionInfo, new QueryExecutionSettings(), fileStreamFactory);
|
||||
@@ -52,18 +52,18 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
query.ExecutionTask.Wait();
|
||||
|
||||
// We should still have 2 DbConnections
|
||||
Assert.Equal(2, connectionInfo.CountConnections);
|
||||
Assert.AreEqual(2, connectionInfo.CountConnections);
|
||||
|
||||
// If we disconnect, we should remain in a consistent state to do it over again
|
||||
// e.g. loop and do it over again
|
||||
service.Disconnect(new DisconnectParams() { OwnerUri = connectionInfo.OwnerUri });
|
||||
|
||||
// We should be left with an empty connection map
|
||||
Assert.Equal(0, service.OwnerToConnectionMap.Count);
|
||||
Assert.AreEqual(0, service.OwnerToConnectionMap.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void DatabaseChangesAffectAllConnections()
|
||||
{
|
||||
// If we make a connection to a live database
|
||||
@@ -87,7 +87,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
{
|
||||
if (connection != null && connection.State == ConnectionState.Open)
|
||||
{
|
||||
Assert.Equal(connection.Database, initialDatabaseName);
|
||||
Assert.AreEqual(connection.Database, initialDatabaseName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
{
|
||||
if (connection != null && connection.State == ConnectionState.Open)
|
||||
{
|
||||
Assert.Equal(connection.Database, newDatabaseName);
|
||||
Assert.AreEqual(connection.Database, newDatabaseName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,8 +109,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Test HandleGetConnectionStringRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GetCurrentConnectionStringTest()
|
||||
[Test]
|
||||
public async Task GetCurrentConnectionStringTest()
|
||||
{
|
||||
// If we make a connection to a live database
|
||||
ConnectionService service = ConnectionService.Instance;
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.RetryPolicy;
|
||||
using static Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.RetryPolicy.TimeBasedRetryPolicy;
|
||||
using static Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.SqlSchemaModelErrorCodes;
|
||||
@@ -122,7 +122,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void FixedDelayPolicyTest()
|
||||
{
|
||||
TestFixedDelayPolicy policy = new TestFixedDelayPolicy(
|
||||
@@ -135,7 +135,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(shouldRety);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void FixedDelayPolicyExecuteActionTest()
|
||||
{
|
||||
TestFixedDelayPolicy policy = new TestFixedDelayPolicy(
|
||||
@@ -145,7 +145,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
|
||||
// execute an action that throws a retry limit exception
|
||||
CancellationToken token = new CancellationToken();
|
||||
Assert.Equal(policy.ExecuteAction<int>((s) => { throw new RetryLimitExceededException(); }, token), default(int));
|
||||
Assert.AreEqual(default(int), policy.ExecuteAction<int>((s) => { throw new RetryLimitExceededException(); }, token));
|
||||
|
||||
// execute an action that throws a retry limit exeception with an inner exception
|
||||
Assert.Throws<Exception>(() =>
|
||||
@@ -158,7 +158,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void IsRetryableExceptionTest()
|
||||
{
|
||||
TestFixedDelayPolicy policy = new TestFixedDelayPolicy(
|
||||
@@ -169,7 +169,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.False(policy.IsRetryableException(new Exception()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ProgressiveRetryPolicyTest()
|
||||
{
|
||||
TestProgressiveRetryPolicy policy = new TestProgressiveRetryPolicy(
|
||||
@@ -184,7 +184,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.False(policy.ShouldIgnoreOnFirstTry);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TimeBasedRetryPolicyTest()
|
||||
{
|
||||
TestTimeBasedRetryPolicy policy = new TestTimeBasedRetryPolicy(
|
||||
@@ -200,7 +200,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetErrorNumberWithNullExceptionTest()
|
||||
{
|
||||
Assert.Null(RetryPolicy.GetErrorNumber(null));
|
||||
@@ -265,7 +265,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Test ReliableConnectionHelper.GetDefaultDatabaseFilePath()
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestGetDefaultDatabaseFilePath()
|
||||
{
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Test ReliableConnectionHelper.GetServerVersion()
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestGetServerVersion()
|
||||
{
|
||||
using (var connection = CreateTestConnection())
|
||||
@@ -324,7 +324,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Tests ReliableConnectionHelper.GetCompleteServerName()
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestGetCompleteServerName()
|
||||
{
|
||||
string name = ReliableConnectionHelper.GetCompleteServerName(@".\SQL2008");
|
||||
@@ -337,7 +337,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Tests ReliableConnectionHelper.IsDatabaseReadonly()
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestIsDatabaseReadonly()
|
||||
{
|
||||
var connectionBuilder = CreateTestConnectionStringBuilder();
|
||||
@@ -350,7 +350,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// /// Tests ReliableConnectionHelper.IsDatabaseReadonly() with null builder parameter
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestIsDatabaseReadonlyWithNullBuilder()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => ReliableConnectionHelper.IsDatabaseReadonly(null, null));
|
||||
@@ -359,7 +359,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Verify ANSI_NULL and QUOTED_IDENTIFIER settings can be set and retrieved for a session
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void VerifyAnsiNullAndQuotedIdentifierSettingsReplayed()
|
||||
{
|
||||
using (ReliableSqlConnection conn = (ReliableSqlConnection) ReliableConnectionHelper.OpenConnection(CreateTestConnectionStringBuilder(), useRetry: true, azureAccountToken: null))
|
||||
@@ -395,11 +395,11 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
AssertSessionValues(cmd, ansiNullsValue: expectedSessionValue, quotedIdentifersValue: expectedSessionValue);
|
||||
|
||||
// assert cached settings are correct
|
||||
Assert.Equal("ANSI_NULLS", settings[0].Item1);
|
||||
Assert.Equal(expectedSessionValue, settings[0].Item2);
|
||||
Assert.AreEqual("ANSI_NULLS", settings[0].Item1);
|
||||
Assert.AreEqual(expectedSessionValue, settings[0].Item2);
|
||||
|
||||
Assert.Equal("QUOTED_IDENTIFIER", settings[1].Item1);
|
||||
Assert.Equal(expectedSessionValue, settings[1].Item2);
|
||||
Assert.AreEqual("QUOTED_IDENTIFIER", settings[1].Item1);
|
||||
Assert.AreEqual(expectedSessionValue, settings[1].Item2);
|
||||
|
||||
// invert session values and assert we reset them
|
||||
|
||||
@@ -433,8 +433,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(reader.Read(), "Missing session settings");
|
||||
bool actualAnsiNullsOnValue = ((int)reader[0] == 1);
|
||||
bool actualQuotedIdentifierOnValue = ((int)reader[1] == 1);
|
||||
Assert.Equal(ansiNullsValue, actualAnsiNullsOnValue);
|
||||
Assert.Equal(quotedIdentifersValue, actualQuotedIdentifierOnValue);
|
||||
Assert.AreEqual(ansiNullsValue, actualAnsiNullsOnValue);
|
||||
Assert.AreEqual(quotedIdentifersValue, actualQuotedIdentifierOnValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -442,7 +442,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Test that the retry policy factory constructs all possible types of policies successfully.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RetryPolicyFactoryConstructsPoliciesSuccessfully()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -468,7 +468,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// ReliableConnectionHelper.IsCloud() should be false for a local server
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestIsCloudIsFalseForLocalServer()
|
||||
{
|
||||
using (var connection = CreateTestConnection())
|
||||
@@ -483,7 +483,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Tests that ReliableConnectionHelper.OpenConnection() opens a connection if it is closed
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestOpenConnectionOpensConnection()
|
||||
{
|
||||
using (var connection = CreateTestConnection())
|
||||
@@ -499,7 +499,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Tests that ReliableConnectionHelper.ExecuteNonQuery() runs successfully
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestExecuteNonQuery()
|
||||
{
|
||||
var result = ReliableConnectionHelper.ExecuteNonQuery(
|
||||
@@ -516,7 +516,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Test that TryGetServerVersion() gets server information
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestTryGetServerVersion()
|
||||
{
|
||||
ReliableConnectionHelper.ServerInfo info = null;
|
||||
@@ -524,14 +524,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(ReliableConnectionHelper.TryGetServerVersion(connBuilder.ConnectionString, out info, null));
|
||||
|
||||
Assert.NotNull(info);
|
||||
Assert.NotNull(info.ServerVersion);
|
||||
Assert.NotEmpty(info.ServerVersion);
|
||||
Assert.That(info.ServerVersion, Is.Not.Null.Or.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that TryGetServerVersion() fails with invalid connection string
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestTryGetServerVersionInvalidConnectionString()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -544,7 +543,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Validate ambient static settings
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void AmbientSettingsStaticPropertiesTest()
|
||||
{
|
||||
var defaultSettings = AmbientSettings.DefaultSettings;
|
||||
@@ -578,7 +577,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
/// <summary>
|
||||
/// Validate ambient settings populate
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void AmbientSettingsPopulateTest()
|
||||
{
|
||||
var data = new AmbientSettings.AmbientData();
|
||||
@@ -626,7 +625,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
data.TraceSettings();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RaiseAmbientRetryMessageTest()
|
||||
{
|
||||
bool handlerCalled = false;
|
||||
@@ -637,7 +636,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(handlerCalled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RaiseAmbientIgnoreMessageTest()
|
||||
{
|
||||
bool handlerCalled = false;
|
||||
@@ -648,7 +647,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(handlerCalled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RetryPolicyFactoryTest()
|
||||
{
|
||||
Assert.NotNull(RetryPolicyFactory.NoRetryPolicy);
|
||||
@@ -673,7 +672,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.False(transientPolicy.ShouldIgnoreError(new Exception()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ReliableConnectionHelperTest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -700,7 +699,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void DataSchemaErrorTests()
|
||||
{
|
||||
var error = new DataSchemaError();
|
||||
@@ -722,7 +721,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.NotNull(DataSchemaError.FormatErrorCode("ex", 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void InitReliableSqlConnectionTest()
|
||||
{
|
||||
var result = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
@@ -743,7 +742,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
connection.ClearPool();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ThrottlingReasonTests()
|
||||
{
|
||||
var reason = RetryPolicy.ThrottlingReason.Unknown;
|
||||
@@ -794,7 +793,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.NotNull(codeReason.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RetryErrorsTest()
|
||||
{
|
||||
var sqlServerRetryError = new SqlServerRetryError(
|
||||
@@ -817,7 +816,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.True(SqlSchemaModelErrorCodes.IsStatementFilterError(StatementFilter.StatementFilterBaseCode + 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RetryCallbackEventArgsTest()
|
||||
{
|
||||
var exception = new Exception();
|
||||
@@ -828,38 +827,38 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
|
||||
// If I check the properties on the object
|
||||
// Then I expect the values to be the same as the values I passed into the constructor
|
||||
Assert.Equal(5, args.RetryCount);
|
||||
Assert.Equal(exception, args.Exception);
|
||||
Assert.Equal(timespan, args.Delay);
|
||||
Assert.AreEqual(5, args.RetryCount);
|
||||
Assert.AreEqual(exception, args.Exception);
|
||||
Assert.AreEqual(timespan, args.Delay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CheckStaticVariables()
|
||||
{
|
||||
Assert.NotNull(ReliableConnectionHelper.BuilderWithDefaultApplicationName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void SetLockAndCommandTimeoutThrowsOnNull()
|
||||
{
|
||||
Assert.Throws(typeof(ArgumentNullException), () => ReliableConnectionHelper.SetLockAndCommandTimeout(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void StandardExceptionHandlerTests()
|
||||
{
|
||||
Assert.True(ReliableConnectionHelper.StandardExceptionHandler(new InvalidCastException()));
|
||||
Assert.False(ReliableConnectionHelper.StandardExceptionHandler(new Exception()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetConnectionStringBuilderNullConnectionString()
|
||||
{
|
||||
SqlConnectionStringBuilder builder;
|
||||
Assert.False(ReliableConnectionHelper.TryGetConnectionStringBuilder(null, out builder));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetConnectionStringBuilderExceptionTests()
|
||||
{
|
||||
SqlConnectionStringBuilder builder;
|
||||
@@ -871,7 +870,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.False(ReliableConnectionHelper.TryGetConnectionStringBuilder("rabbits**frogs**lizards", out builder));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetCompleteServerNameTests()
|
||||
{
|
||||
Assert.Null(ReliableConnectionHelper.GetCompleteServerName(null));
|
||||
@@ -881,7 +880,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.NotNull(ReliableConnectionHelper.GetCompleteServerName("mytestservername"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ReliableSqlCommandConstructorTests()
|
||||
{
|
||||
// verify default constructor doesn't throw
|
||||
@@ -891,18 +890,18 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.NotNull(new ReliableSqlConnection.ReliableSqlCommand(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ReliableSqlCommandProperties()
|
||||
{
|
||||
var command = new ReliableSqlConnection.ReliableSqlCommand();
|
||||
command.CommandText = "SELECT 1";
|
||||
Assert.Equal(command.CommandText, "SELECT 1");
|
||||
Assert.AreEqual("SELECT 1", command.CommandText);
|
||||
Assert.NotNull(command.CommandTimeout);
|
||||
Assert.NotNull(command.CommandType);
|
||||
command.DesignTimeVisible = true;
|
||||
Assert.True(command.DesignTimeVisible);
|
||||
command.UpdatedRowSource = UpdateRowSource.None;
|
||||
Assert.Equal(command.UpdatedRowSource, UpdateRowSource.None);
|
||||
Assert.AreEqual(UpdateRowSource.None, command.UpdatedRowSource);
|
||||
Assert.NotNull(command.GetUnderlyingCommand());
|
||||
Assert.Throws<InvalidOperationException>(() => command.ValidateConnectionIsSet());
|
||||
command.Prepare();
|
||||
@@ -910,7 +909,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
command.Cancel();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ReliableConnectionResourcesTests()
|
||||
{
|
||||
Assert.NotNull(Resources.ConnectionPassedToIsCloudShouldBeOpen);
|
||||
@@ -924,19 +923,19 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection
|
||||
Assert.NotNull(Resources.UnableToRetrieveAzureSessionId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CalcExponentialRetryDelayWithSchemaDefaultsTest()
|
||||
{
|
||||
Assert.NotNull(RetryPolicyUtils.CalcExponentialRetryDelayWithSchemaDefaults(1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void IsSupportedCommandNullCommandTest()
|
||||
{
|
||||
Assert.False(DbCommandWrapper.IsSupportedCommand(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void StatementCompletedTests()
|
||||
{
|
||||
StatementCompletedEventHandler handler = (s, e) => { };
|
||||
|
||||
@@ -17,8 +17,8 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using NUnit.Framework;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DacFx
|
||||
{
|
||||
@@ -71,8 +71,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the export bacpac request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExportBacpac()
|
||||
[Test]
|
||||
public async Task ExportBacpac()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb testdb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, null, "DacFxExportTest");
|
||||
@@ -102,8 +102,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the import bacpac request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ImportBacpac()
|
||||
[Test]
|
||||
public async Task ImportBacpac()
|
||||
{
|
||||
// first export a bacpac
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
@@ -150,8 +150,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the extract dacpac request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExtractDacpac()
|
||||
[Test]
|
||||
public async Task ExtractDacpac()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb testdb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, null, "DacFxExtractTest");
|
||||
@@ -183,8 +183,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the extract request to create Sql file
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExtractDBToFileTarget()
|
||||
[Test]
|
||||
public async Task ExtractDBToFileTarget()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb testdb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, doNotCleanupDb: false, databaseName: null, query: SourceScript, dbNamePrefix: "DacFxExtractDBToFileTarget");
|
||||
@@ -217,8 +217,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the extract request to create a Flat file structure
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExtractDBToFlatTarget()
|
||||
[Test]
|
||||
public async Task ExtractDBToFlatTarget()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb testdb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, doNotCleanupDb: false, databaseName: null, query: SourceScript, dbNamePrefix: "DacFxExtractDBToFlatTarget");
|
||||
@@ -243,7 +243,7 @@ RETURN 0
|
||||
// Verify two sql files are generated in the target folder path
|
||||
// for dev-servers where there are more users/permissions present on server - the extract might have more files than just 2 expected tables, so check only for tables
|
||||
int actualCnt = Directory.GetFiles(folderPath, "table*.sql", SearchOption.AllDirectories).Length;
|
||||
Assert.Equal(2, actualCnt);
|
||||
Assert.AreEqual(2, actualCnt);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -259,8 +259,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the deploy dacpac request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void DeployDacpac()
|
||||
[Test]
|
||||
public async Task DeployDacpac()
|
||||
{
|
||||
// first extract a db to have a dacpac to import later
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
@@ -305,13 +305,14 @@ RETURN 0
|
||||
targetDb.Cleanup();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify the export request being cancelled
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExportBacpacCancellationTest()
|
||||
[Test]
|
||||
public async Task ExportBacpacCancellationTest()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb testdb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, null, "DacFxExportTest");
|
||||
@@ -353,8 +354,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the generate deploy script request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GenerateDeployScript()
|
||||
[Test]
|
||||
public async Task GenerateDeployScript()
|
||||
{
|
||||
// first extract a dacpac
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
@@ -378,8 +379,8 @@ RETURN 0
|
||||
service.PerformOperation(generateScriptOperation, TaskExecutionMode.Script);
|
||||
|
||||
// Verify script was generated
|
||||
Assert.NotEmpty(generateScriptOperation.Result.DatabaseScript);
|
||||
Assert.Contains("CREATE TABLE", generateScriptOperation.Result.DatabaseScript);
|
||||
Assert.That(generateScriptOperation.Result.DatabaseScript, Is.Not.Empty);
|
||||
Assert.That(generateScriptOperation.Result.DatabaseScript, Does.Contain("CREATE TABLE"));
|
||||
|
||||
VerifyAndCleanup(dacpacPath);
|
||||
}
|
||||
@@ -393,8 +394,8 @@ RETURN 0
|
||||
/// <summary>
|
||||
/// Verify the generate deploy plan request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GenerateDeployPlan()
|
||||
[Test]
|
||||
public async Task GenerateDeployPlan()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "DacFxGenerateDeployPlanTest");
|
||||
@@ -418,9 +419,12 @@ RETURN 0
|
||||
service.PerformOperation(generateDeployPlanOperation, TaskExecutionMode.Execute);
|
||||
string report = generateDeployPlanOperation.DeployReport;
|
||||
Assert.NotNull(report);
|
||||
Assert.Contains("Create", report);
|
||||
Assert.Contains("Drop", report);
|
||||
Assert.Contains("Alter", report);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(report, Does.Contain("Create"));
|
||||
Assert.That(report, Does.Contain("Drop"));
|
||||
Assert.That(report, Does.Contain("Alter"));
|
||||
});
|
||||
|
||||
VerifyAndCleanup(dacpacPath);
|
||||
}
|
||||
@@ -437,8 +441,8 @@ RETURN 0
|
||||
// <summary>
|
||||
/// Verify that SqlCmdVars are set correctly for a deploy request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void DeployWithSqlCmdVariables()
|
||||
[Test]
|
||||
public async Task DeployWithSqlCmdVariables()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, query: storedProcScript, dbNamePrefix: "DacFxDeploySqlCmdVarsTest");
|
||||
@@ -482,8 +486,8 @@ RETURN 0
|
||||
}
|
||||
}
|
||||
|
||||
Assert.Contains(deployParams.SqlCommandVariableValues[databaseRefVarName], deployedProc);
|
||||
Assert.Contains(deployParams.SqlCommandVariableValues[filterValueVarName], deployedProc);
|
||||
Assert.That(deployedProc, Does.Contain(deployParams.SqlCommandVariableValues[databaseRefVarName]));
|
||||
Assert.That(deployedProc, Does.Contain(deployParams.SqlCommandVariableValues[filterValueVarName]));
|
||||
|
||||
VerifyAndCleanup(dacpacPath);
|
||||
}
|
||||
@@ -500,8 +504,8 @@ RETURN 0
|
||||
// <summary>
|
||||
/// Verify that SqlCmdVars are set correctly for a generate script request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GenerateDeployScriptWithSqlCmdVariables()
|
||||
[Test]
|
||||
public async Task GenerateDeployScriptWithSqlCmdVariables()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, query: storedProcScript, dbNamePrefix: "DacFxGenerateScriptSqlCmdVarsTest");
|
||||
@@ -528,9 +532,9 @@ RETURN 0
|
||||
service.PerformOperation(generateScriptOperation, TaskExecutionMode.Script);
|
||||
|
||||
// Verify the SqlCmdVars were set correctly in the script
|
||||
Assert.NotEmpty(generateScriptOperation.Result.DatabaseScript);
|
||||
Assert.Contains($":setvar {databaseRefVarName} \"{generateScriptParams.SqlCommandVariableValues[databaseRefVarName]}\"", generateScriptOperation.Result.DatabaseScript);
|
||||
Assert.Contains($":setvar {filterValueVarName} \"{generateScriptParams.SqlCommandVariableValues[filterValueVarName]}\"", generateScriptOperation.Result.DatabaseScript);
|
||||
Assert.That(generateScriptOperation.Result.DatabaseScript, Is.Not.Empty);
|
||||
Assert.That(generateScriptOperation.Result.DatabaseScript, Does.Contain($":setvar {databaseRefVarName} \"{generateScriptParams.SqlCommandVariableValues[databaseRefVarName]}\""));
|
||||
Assert.That(generateScriptOperation.Result.DatabaseScript, Does.Contain($":setvar {filterValueVarName} \"{generateScriptParams.SqlCommandVariableValues[filterValueVarName]}\""));
|
||||
|
||||
VerifyAndCleanup(dacpacPath);
|
||||
}
|
||||
@@ -543,8 +547,8 @@ RETURN 0
|
||||
///
|
||||
/// Verify that options are set correctly for a deploy request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void DeployWithOptions()
|
||||
[Test]
|
||||
public async Task DeployWithOptions()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, query: SourceScript, dbNamePrefix: "DacFxDeployOptionsTestSource");
|
||||
@@ -607,10 +611,10 @@ RETURN 0
|
||||
{
|
||||
await conn.OpenAsync();
|
||||
var deployedResult = (string)ReliableConnectionHelper.ExecuteScalar(conn, $"SELECT TABLE_NAME FROM {targetDb.DatabaseName}.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'table3'; ");
|
||||
Assert.Equal(expectedTableResult, deployedResult);
|
||||
Assert.AreEqual(expectedTableResult, deployedResult);
|
||||
|
||||
deployedResult = (string)ReliableConnectionHelper.ExecuteScalar(conn, $"SELECT TABLE_NAME FROM {targetDb.DatabaseName}.INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view1'; ");
|
||||
Assert.Equal(expectedViewResult, deployedResult);
|
||||
Assert.AreEqual(expectedViewResult, deployedResult);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -622,8 +626,8 @@ RETURN 0
|
||||
// <summary>
|
||||
/// Verify that options are set correctly for a generate script request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GenerateDeployScriptWithOptions()
|
||||
[Test]
|
||||
public async Task GenerateDeployScriptWithOptions()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, query: SourceScript, dbNamePrefix: "DacFxDeployOptionsTestSource");
|
||||
@@ -651,8 +655,8 @@ RETURN 0
|
||||
var generateScriptFalseOptionOperation = new GenerateDeployScriptOperation(generateScriptFalseOptionParams, result.ConnectionInfo);
|
||||
service.PerformOperation(generateScriptFalseOptionOperation, TaskExecutionMode.Execute);
|
||||
|
||||
Assert.DoesNotContain("table3", generateScriptFalseOptionOperation.Result.DatabaseScript);
|
||||
Assert.DoesNotContain("CREATE VIEW", generateScriptFalseOptionOperation.Result.DatabaseScript);
|
||||
Assert.That(generateScriptFalseOptionOperation.Result.DatabaseScript, Does.Not.Contain("table3"));
|
||||
Assert.That(generateScriptFalseOptionOperation.Result.DatabaseScript, Does.Not.Contain("CREATE VIEW"));
|
||||
|
||||
// try to deploy with the option set to true to make sure it works
|
||||
var generateScriptTrueOptionParams = new GenerateDeployScriptParams
|
||||
@@ -669,8 +673,8 @@ RETURN 0
|
||||
var generateScriptTrueOptionOperation = new GenerateDeployScriptOperation(generateScriptTrueOptionParams, result.ConnectionInfo);
|
||||
service.PerformOperation(generateScriptTrueOptionOperation, TaskExecutionMode.Execute);
|
||||
|
||||
Assert.Contains("DROP TABLE [dbo].[table3]", generateScriptTrueOptionOperation.Result.DatabaseScript);
|
||||
Assert.DoesNotContain("CREATE VIEW", generateScriptTrueOptionOperation.Result.DatabaseScript);
|
||||
Assert.That(generateScriptTrueOptionOperation.Result.DatabaseScript, Does.Contain("DROP TABLE [dbo].[table3]"));
|
||||
Assert.That(generateScriptTrueOptionOperation.Result.DatabaseScript, Does.Not.Contain("CREATE VIEW"));
|
||||
|
||||
// now generate script without options
|
||||
var generateScriptNoOptionsParams = new GenerateDeployScriptParams
|
||||
@@ -682,8 +686,8 @@ RETURN 0
|
||||
var generateScriptNoOptionsOperation = new GenerateDeployScriptOperation(generateScriptNoOptionsParams, result.ConnectionInfo);
|
||||
service.PerformOperation(generateScriptNoOptionsOperation, TaskExecutionMode.Execute);
|
||||
|
||||
Assert.Contains("table3", generateScriptNoOptionsOperation.Result.DatabaseScript);
|
||||
Assert.Contains("CREATE VIEW", generateScriptNoOptionsOperation.Result.DatabaseScript);
|
||||
Assert.That(generateScriptNoOptionsOperation.Result.DatabaseScript, Does.Contain("table3"));
|
||||
Assert.That(generateScriptNoOptionsOperation.Result.DatabaseScript, Does.Contain("CREATE VIEW"));
|
||||
|
||||
VerifyAndCleanup(dacpacPath);
|
||||
}
|
||||
@@ -700,8 +704,8 @@ RETURN 0
|
||||
// <summary>
|
||||
/// Verify that options can get retrieved from publish profile
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GetOptionsFromProfile()
|
||||
[Test]
|
||||
public async Task GetOptionsFromProfile()
|
||||
{
|
||||
DeploymentOptions expectedResults = new DeploymentOptions()
|
||||
{
|
||||
@@ -729,8 +733,8 @@ RETURN 0
|
||||
// <summary>
|
||||
/// Verify that default options are returned if a profile doesn't specify any options
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GetOptionsFromProfileWithoutOptions()
|
||||
[Test]
|
||||
public async Task GetOptionsFromProfileWithoutOptions()
|
||||
{
|
||||
DeploymentOptions expectedResults = new DeploymentOptions();
|
||||
expectedResults.ExcludeObjectTypes = null;
|
||||
|
||||
@@ -22,7 +22,7 @@ using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
{
|
||||
@@ -42,8 +42,8 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
/// Get backup configuration info
|
||||
/// </summary>
|
||||
/// Test is failing in code coverage runs. Reenable when stable.
|
||||
///[Fact]
|
||||
public async void GetBackupConfigInfoTest()
|
||||
///[Test]
|
||||
public async Task GetBackupConfigInfoTest()
|
||||
{
|
||||
string databaseName = "testbackup_" + new Random().Next(10000000, 99999999);
|
||||
using (SqlTestDb testDb = SqlTestDb.CreateNew(TestServerType.OnPrem, false, databaseName))
|
||||
@@ -72,7 +72,7 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
/// <summary>
|
||||
/// Create simple backup test
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CreateBackupTest()
|
||||
{
|
||||
DisasterRecoveryService service = new DisasterRecoveryService();
|
||||
@@ -100,7 +100,7 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ScriptBackupTest()
|
||||
{
|
||||
DisasterRecoveryService service = new DisasterRecoveryService();
|
||||
@@ -137,7 +137,7 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
/// <summary>
|
||||
/// Test creating backup with advanced options set.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CreateBackupWithAdvancedOptionsTest()
|
||||
{
|
||||
DisasterRecoveryService service = new DisasterRecoveryService();
|
||||
@@ -190,7 +190,7 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
/// <summary>
|
||||
/// Test creating backup with advanced options set.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ScriptBackupWithAdvancedOptionsTest()
|
||||
{
|
||||
DisasterRecoveryService service = new DisasterRecoveryService();
|
||||
@@ -245,7 +245,7 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
/// <summary>
|
||||
/// Test the correct script generation for different backup action types
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ScriptBackupWithDifferentActionTypesTest()
|
||||
{
|
||||
string databaseName = "SqlToolsService_TestBackup_" + new Random().Next(10000000, 99999999);
|
||||
@@ -255,30 +255,30 @@ CREATE CERTIFICATE {1} WITH SUBJECT = 'Backup Encryption Certificate'; ";
|
||||
string script = GenerateScriptForBackupType(BackupType.Full, databaseName);
|
||||
|
||||
// Validate Full backup script
|
||||
Assert.Contains("BACKUP DATABASE", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.DoesNotContain("BACKUP LOG", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.DoesNotContain("DIFFERENTIAL", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.That(script, Does.Contain("BACKUP DATABASE").IgnoreCase);
|
||||
Assert.That(script, Does.Not.Contain("BACKUP LOG").IgnoreCase);
|
||||
Assert.That(script, Does.Not.Contain("DIFFERENTIAL").IgnoreCase);
|
||||
|
||||
// Create log backup script
|
||||
script = GenerateScriptForBackupType(BackupType.TransactionLog, databaseName);
|
||||
|
||||
// Validate Log backup script
|
||||
Assert.Contains("BACKUP LOG", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.DoesNotContain("BACKUP DATABASE", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.DoesNotContain("DIFFERENTIAL", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.That(script, Does.Contain("BACKUP LOG").IgnoreCase);
|
||||
Assert.That(script, Does.Not.Contain("BACKUP DATABASE").IgnoreCase);
|
||||
Assert.That(script, Does.Not.Contain("DIFFERENTIAL").IgnoreCase);
|
||||
|
||||
// Create differential backup script
|
||||
script = GenerateScriptForBackupType(BackupType.Differential, databaseName);
|
||||
|
||||
// Validate differential backup script
|
||||
Assert.Contains("BACKUP DATABASE", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.DoesNotContain("BACKUP LOG", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("WITH DIFFERENTIAL", script, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.That(script, Does.Contain("BACKUP DATABASE").IgnoreCase);
|
||||
Assert.That(script, Does.Not.Contain("BACKUP LOG").IgnoreCase);
|
||||
Assert.That(script, Does.Contain("WITH DIFFERENTIAL").IgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void BackupFileBrowserTest()
|
||||
//[Test]
|
||||
public async Task BackupFileBrowserTest()
|
||||
{
|
||||
string databaseName = "testfilebrowser_" + new Random().Next(10000000, 99999999);
|
||||
SqlTestDb testDb = SqlTestDb.CreateNew(TestServerType.OnPrem, false, databaseName);
|
||||
|
||||
@@ -13,7 +13,7 @@ using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.FileBrowser;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
/// </summary>
|
||||
public class DisasterRecoveryFileValidatorTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ValidateDefaultBackupFullFilePath()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
@@ -39,10 +39,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}, out message);
|
||||
|
||||
Assert.True(result);
|
||||
Assert.Empty(message);
|
||||
Assert.That(message, Is.Empty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ValidateDefaultBackupFolderPath()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
@@ -56,7 +56,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
//[Test]
|
||||
public void ValidatorShouldReturnFalseForInvalidPath()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
|
||||
@@ -23,7 +23,7 @@ using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.UnitTests;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
@@ -65,16 +65,16 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
return backupFilesToRecoverDatabase;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestorePlanShouldCreatedSuccessfullyForFullBackup()
|
||||
[Test]
|
||||
public async Task RestorePlanShouldCreatedSuccessfullyForFullBackup()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
bool canRestore = true;
|
||||
await VerifyRestore(fullBackupFilePath, canRestore);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldNotRestoreAnyBackupSetsIfFullNotSelected()
|
||||
[Test]
|
||||
public async Task RestoreShouldNotRestoreAnyBackupSetsIfFullNotSelected()
|
||||
{
|
||||
var backupFiles = await GetBackupFilesToRecoverDatabaseCreated();
|
||||
//Remove the full backupset
|
||||
@@ -85,8 +85,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
await VerifyRestoreMultipleBackupSets(backupFiles, indexToDelete, expectedTable, TaskExecutionModeFlag.Execute);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldRestoreFromAnotherDatabase()
|
||||
[Test]
|
||||
public async Task RestoreShouldRestoreFromAnotherDatabase()
|
||||
{
|
||||
await GetBackupFilesToRecoverDatabaseCreated();
|
||||
|
||||
@@ -106,8 +106,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldFailIfThereAreOtherConnectionsToDatabase()
|
||||
[Test]
|
||||
public async Task RestoreShouldFailIfThereAreOtherConnectionsToDatabase()
|
||||
{
|
||||
await GetBackupFilesToRecoverDatabaseCreated();
|
||||
|
||||
@@ -138,8 +138,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldFailIfThereAreOtherConnectionsToDatabase2()
|
||||
[Test]
|
||||
public async Task RestoreShouldFailIfThereAreOtherConnectionsToDatabase2()
|
||||
{
|
||||
await GetBackupFilesToRecoverDatabaseCreated();
|
||||
|
||||
@@ -173,8 +173,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldCloseOtherConnectionsBeforeExecuting()
|
||||
[Test]
|
||||
public async Task RestoreShouldCloseOtherConnectionsBeforeExecuting()
|
||||
{
|
||||
await GetBackupFilesToRecoverDatabaseCreated();
|
||||
|
||||
@@ -213,8 +213,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldRestoreTheBackupSetsThatAreSelected()
|
||||
[Test]
|
||||
public async Task RestoreShouldRestoreTheBackupSetsThatAreSelected()
|
||||
{
|
||||
var backupFiles = await GetBackupFilesToRecoverDatabaseCreated();
|
||||
//Remove the last backupset
|
||||
@@ -225,8 +225,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
await VerifyRestoreMultipleBackupSets(backupFiles, indexToDelete, expectedTable);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldNotRestoreTheLogBackupSetsIfOneNotSelected()
|
||||
[Test]
|
||||
public async Task RestoreShouldNotRestoreTheLogBackupSetsIfOneNotSelected()
|
||||
{
|
||||
var backupFiles = await GetBackupFilesToRecoverDatabaseCreated();
|
||||
//Remove the one of the log backup sets
|
||||
@@ -276,7 +276,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
for (int i = 0; i < response.BackupSetsToRestore.Count(); i++)
|
||||
{
|
||||
DatabaseFileInfo databaseInfo = response.BackupSetsToRestore[i];
|
||||
Assert.Equal(databaseInfo.IsSelected, expectedSelectedIndexes.Contains(i));
|
||||
Assert.AreEqual(databaseInfo.IsSelected, expectedSelectedIndexes.Contains(i));
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -288,8 +288,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestorePlanShouldCreatedSuccessfullyOnExistingDatabaseGivenReplaceOption()
|
||||
[Test]
|
||||
public async Task RestorePlanShouldCreatedSuccessfullyOnExistingDatabaseGivenReplaceOption()
|
||||
{
|
||||
SqlTestDb testDb = null;
|
||||
try
|
||||
@@ -312,8 +312,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestorePlanShouldFailOnExistingDatabaseNotGivenReplaceOption()
|
||||
[Test]
|
||||
public async Task RestorePlanShouldFailOnExistingDatabaseNotGivenReplaceOption()
|
||||
{
|
||||
SqlTestDb testDb = null;
|
||||
try
|
||||
@@ -334,8 +334,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void RestoreShouldCreatedSuccessfullyGivenTwoBackupFiles()
|
||||
//[Test]
|
||||
public async Task RestoreShouldCreatedSuccessfullyGivenTwoBackupFiles()
|
||||
{
|
||||
|
||||
string[] backupFileNames = new string[] { "FullBackup.bak", "DiffBackup.bak" };
|
||||
@@ -344,8 +344,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
Assert.True(response.BackupSetsToRestore.Count() == 2);
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void RestoreShouldFailGivenTwoBackupFilesButFilterFullBackup()
|
||||
//[Test]
|
||||
public async Task RestoreShouldFailGivenTwoBackupFilesButFilterFullBackup()
|
||||
{
|
||||
|
||||
string[] backupFileNames = new string[] { "FullBackup.bak", "DiffBackup.bak" };
|
||||
@@ -360,8 +360,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void RestoreShouldCompletedSuccessfullyGivenTwoBackupFilesButFilterDifferentialBackup()
|
||||
//[Test]
|
||||
public async Task RestoreShouldCompletedSuccessfullyGivenTwoBackupFilesButFilterDifferentialBackup()
|
||||
{
|
||||
|
||||
string[] backupFileNames = new string[] { "FullBackup.bak", "DiffBackup.bak" };
|
||||
@@ -376,8 +376,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreShouldExecuteSuccessfullyForFullBackup()
|
||||
[Test]
|
||||
public async Task RestoreShouldExecuteSuccessfullyForFullBackup()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
|
||||
@@ -387,8 +387,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
Assert.NotNull(restorePlan.BackupSetsToRestore);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RestoreToAnotherDatabaseShouldExecuteSuccessfullyForFullBackup()
|
||||
[Test]
|
||||
public async Task RestoreToAnotherDatabaseShouldExecuteSuccessfullyForFullBackup()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
|
||||
@@ -397,23 +397,23 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
var restorePlan = await VerifyRestore(backupFileName, canRestore, TaskExecutionModeFlag.ExecuteAndScript, "NewRestoredDatabase");
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void RestorePlanShouldCreatedSuccessfullyForDiffBackup()
|
||||
//[Test]
|
||||
public async Task RestorePlanShouldCreatedSuccessfullyForDiffBackup()
|
||||
{
|
||||
string backupFileName = "DiffBackup.bak";
|
||||
bool canRestore = true;
|
||||
await VerifyRestore(backupFileName, canRestore);
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
public async void RestorePlanShouldCreatedSuccessfullyForTransactionLogBackup()
|
||||
//[Test]
|
||||
public async Task RestorePlanShouldCreatedSuccessfullyForTransactionLogBackup()
|
||||
{
|
||||
string backupFileName = "TransactionLogBackup.bak";
|
||||
bool canRestore = true;
|
||||
await VerifyRestore(backupFileName, canRestore);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task RestorePlanRequestShouldReturnResponseWithDbFiles()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
@@ -439,7 +439,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task CancelRestorePlanRequestShouldCancelSuccessfully()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
@@ -473,7 +473,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task RestoreConfigInfoRequestShouldReturnResponse()
|
||||
{
|
||||
await VerifyBackupFileCreated();
|
||||
@@ -499,7 +499,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task RestoreDatabaseRequestShouldStartTheRestoreTask()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -526,7 +526,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task RestorePlanRequestShouldReturnErrorMessageGivenInvalidFilePath()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -625,7 +625,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.False(string.IsNullOrWhiteSpace(response.SessionId));
|
||||
Assert.Equal(response.CanRestore, canRestore);
|
||||
Assert.AreEqual(response.CanRestore, canRestore);
|
||||
if (canRestore)
|
||||
{
|
||||
Assert.True(response.DbFiles.Any());
|
||||
@@ -633,7 +633,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
{
|
||||
targetDatabase = response.DatabaseName;
|
||||
}
|
||||
Assert.Equal(response.DatabaseName, targetDatabase);
|
||||
Assert.AreEqual(response.DatabaseName, targetDatabase);
|
||||
Assert.NotNull(response.PlanDetails);
|
||||
Assert.True(response.PlanDetails.Any());
|
||||
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.BackupTailLog]);
|
||||
@@ -649,7 +649,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
{
|
||||
request.SessionId = response.SessionId;
|
||||
restoreDataObject = service.CreateRestoreDatabaseTaskDataObject(request);
|
||||
Assert.Equal(response.SessionId, restoreDataObject.SessionId);
|
||||
Assert.AreEqual(response.SessionId, restoreDataObject.SessionId);
|
||||
request.RelocateDbFiles = !restoreDataObject.DbFilesLocationAreValid();
|
||||
restoreDataObject.Execute((TaskExecutionMode)Enum.Parse(typeof(TaskExecutionMode), executionMode.ToString()));
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
||||
//Some tests still verify the number of backup sets that are executed which in some cases can be less than the selected list
|
||||
if (verifyDatabase == null && selectedBackupSets != null)
|
||||
{
|
||||
Assert.Equal(selectedBackupSets.Count(), restoreDataObject.RestorePlanToExecute.RestoreOperations.Count());
|
||||
Assert.AreEqual(selectedBackupSets.Count(), restoreDataObject.RestorePlanToExecute.RestoreOperations.Count());
|
||||
}
|
||||
}
|
||||
if(executionMode.HasFlag(TaskExecutionModeFlag.Script))
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.SqlTools.ServiceLayer.FileBrowser.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
{
|
||||
@@ -21,8 +21,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
{
|
||||
#region Request handle tests
|
||||
|
||||
[Fact]
|
||||
public async void HandleFileBrowserOpenRequestTest()
|
||||
[Test]
|
||||
public async Task HandleFileBrowserOpenRequestTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -41,8 +41,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
openRequestContext.Verify(x => x.SendResult(It.Is<bool>(p => p == true)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void HandleFileBrowserExpandRequestTest()
|
||||
[Test]
|
||||
public async Task HandleFileBrowserExpandRequestTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -59,8 +59,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
requestContext.Verify(x => x.SendResult(It.Is<bool>(p => p == true)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void HandleFileBrowserValidateRequestTest()
|
||||
[Test]
|
||||
public async Task HandleFileBrowserValidateRequestTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -77,8 +77,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
requestContext.Verify(x => x.SendResult(It.Is<bool>(p => p == true)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void HandleFileBrowserCloseRequestTest()
|
||||
[Test]
|
||||
public async Task HandleFileBrowserCloseRequestTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -96,8 +96,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
|
||||
#endregion
|
||||
|
||||
[Fact]
|
||||
public async void OpenFileBrowserTest()
|
||||
[Test]
|
||||
public async Task OpenFileBrowserTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -123,8 +123,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
efv.Validate();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void ValidateSelectedFilesWithNullValidatorTest()
|
||||
[Test]
|
||||
public async Task ValidateSelectedFilesWithNullValidatorTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
@@ -146,8 +146,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.FileBrowser
|
||||
efv.Validate();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void InvalidFileValidationTest()
|
||||
[Test]
|
||||
public async Task InvalidFileValidationTest()
|
||||
{
|
||||
FileBrowserService service = new FileBrowserService();
|
||||
service.RegisterValidatePathsCallback("TestService", ValidatePaths);
|
||||
|
||||
@@ -17,15 +17,15 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
{
|
||||
public class ExternalLanguageServiceTests : ServiceTestBase
|
||||
{
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageStatusRequest()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageStatusRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -50,8 +50,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageDeleteRequest()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageDeleteRequest()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -80,8 +80,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageDeleteRequestFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageDeleteRequestFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -106,8 +106,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageDeleteRequestConnectionFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageDeleteRequestConnectionFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -131,8 +131,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageUpdateRequest()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageUpdateRequest()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -161,8 +161,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageUpdateRequestFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageUpdateRequestFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -187,8 +187,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageUpdateRequestConnectionFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageUpdateRequestConnectionFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -212,8 +212,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageListRequest()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageListRequest()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -241,8 +241,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguagListRequestFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguagListRequestFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -266,8 +266,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguagListRequestConnectionFailures()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguagListRequestConnectionFailures()
|
||||
{
|
||||
ExternalLanguage language = new ExternalLanguage
|
||||
{
|
||||
@@ -323,8 +323,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageExtensibility
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyExternalLanguageStatusRequestSendErrorGivenInvalidConnection()
|
||||
[Test]
|
||||
public async Task VerifyExternalLanguageStatusRequestSendErrorGivenInvalidConnection()
|
||||
{
|
||||
ExternalLanguageStatusResponseParams result = null;
|
||||
var requestContext = RequestContextMocks.Create<ExternalLanguageStatusResponseParams>(r => result = r).AddErrorHandling(null);
|
||||
|
||||
@@ -22,7 +22,7 @@ using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// <summary>
|
||||
/// Test the service initialization code path and verify nothing throws
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ServiceInitialization()
|
||||
{
|
||||
try
|
||||
@@ -72,7 +72,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// <summary>
|
||||
/// Test the service initialization code path and verify nothing throws
|
||||
/// </summary>
|
||||
//[Fact]
|
||||
//[Test]
|
||||
public void PrepopulateCommonMetadata()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -89,7 +89,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// <summary>
|
||||
/// This test tests auto completion
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void AutoCompleteFindCompletions()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
@@ -123,8 +123,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// 2. Initializing a completion extension implementation
|
||||
/// 3. Excuting an auto completion with extension enabled
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void AutoCompleteWithExtension()
|
||||
[Test]
|
||||
public async Task AutoCompleteWithExtension()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// has an associated ScriptParseInfo and the provided query has a function that should
|
||||
/// provide signature help.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetSignatureHelpReturnsNotNullIfParseInfoInitialized()
|
||||
{
|
||||
// When we make a connection to a live database
|
||||
@@ -257,7 +257,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// <summary>
|
||||
/// Test overwriting the binding queue context
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void OverwriteBindingContext()
|
||||
{
|
||||
var result = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
@@ -279,7 +279,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
/// <summary>
|
||||
/// Verifies that clearing the Intellisense cache correctly refreshes the cache with new info from the DB.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task RebuildIntellisenseCacheClearsScriptParseInfoCorrectly()
|
||||
{
|
||||
var testDb = SqlTestDb.CreateNew(TestServerType.OnPrem, false, null, null, "LangSvcTest");
|
||||
@@ -338,7 +338,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
||||
// This test validates switching off editor intellisesnse for now.
|
||||
// Will change to better handling once we have specific SQLCMD intellisense in Language Service
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task HandleRequestToChangeToSqlcmdFile()
|
||||
{
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ using System;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using ConnectionType = Microsoft.SqlTools.ServiceLayer.Connection.ConnectionType;
|
||||
using Location = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Location;
|
||||
using System.Collections.Generic;
|
||||
@@ -86,7 +86,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a table object with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetValidTableDefinitionTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -105,7 +105,7 @@ GO";
|
||||
Cleanup(locations);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void LoggerGetValidTableDefinitionTest()
|
||||
{
|
||||
TestLogger test = new TestLogger()
|
||||
@@ -126,7 +126,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a invalid table object with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetTableDefinitionInvalidObjectTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -146,7 +146,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a valid table object with schema and active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetTableDefinitionWithSchemaTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -168,7 +168,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test GetDefinition with an unsupported type(schema - dbo). Expect a error result.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetUnsupportedDefinitionErrorTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -187,7 +187,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Get Definition for a object with no definition. Expect a error result
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionWithNoResultsFoundError()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -206,13 +206,13 @@ GO";
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.IsErrorResult);
|
||||
Assert.Equal(SR.PeekDefinitionNoResultsError, result.Message);
|
||||
Assert.AreEqual(SR.PeekDefinitionNoResultsError, result.Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetDefinition with a forced timeout. Expect a error result.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionTimeoutTest()
|
||||
{
|
||||
// Given a binding queue that will automatically time out
|
||||
@@ -268,13 +268,13 @@ GO";
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.IsErrorResult);
|
||||
// Check timeout message
|
||||
Assert.Equal(SR.PeekDefinitionTimedoutError, result.Message);
|
||||
Assert.AreEqual(SR.PeekDefinitionTimedoutError, result.Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test get definition for a view object with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetValidViewDefinitionTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -293,7 +293,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for an invalid view object with no schema name and with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetViewDefinitionInvalidObjectTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -312,7 +312,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a stored procedure object with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetStoredProcedureDefinitionTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -333,7 +333,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a stored procedure object that does not exist with active connection
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetStoredProcedureDefinitionFailureTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -352,7 +352,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a stored procedure object with active connection and no schema
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetStoredProcedureDefinitionWithoutSchemaTest()
|
||||
{
|
||||
// Get live connectionInfo and serverConnection
|
||||
@@ -372,7 +372,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a scalar valued function object with active connection and explicit schema name. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetScalarValuedFunctionDefinitionWithSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(AddTwoFunctionQuery, AddTwoFunctionName, ScalarValuedFunctionTypeName);
|
||||
@@ -421,7 +421,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a table valued function object with active connection and explicit schema name. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetTableValuedFunctionDefinitionWithSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, ScalarValuedFunctionTypeName);
|
||||
@@ -430,7 +430,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a scalar valued function object that doesn't exist with active connection. Expect null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetScalarValuedFunctionDefinitionWithNonExistentFailureTest()
|
||||
{
|
||||
string objectName = "doesNotExist";
|
||||
@@ -443,7 +443,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a table valued function object that doesn't exist with active connection. Expect null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetTableValuedFunctionDefinitionWithNonExistentObjectFailureTest()
|
||||
{
|
||||
string objectName = "doesNotExist";
|
||||
@@ -455,7 +455,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a scalar valued function object with active connection. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetScalarValuedFunctionDefinitionWithoutSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(AddTwoFunctionQuery, AddTwoFunctionName, ScalarValuedFunctionTypeName, null);
|
||||
@@ -464,7 +464,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a table valued function object with active connection. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetTableValuedFunctionDefinitionWithoutSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(ReturnTableTableFunctionQuery, ReturnTableFunctionName, ScalarValuedFunctionTypeName, null);
|
||||
@@ -474,7 +474,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined data type object with active connection and explicit schema name. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedDataTypeDefinitionWithSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(SsnTypeQuery, SsnTypeName, UserDefinedDataTypeTypeName);
|
||||
@@ -483,7 +483,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined data type object with active connection. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedDataTypeDefinitionWithoutSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(SsnTypeQuery, SsnTypeName, UserDefinedDataTypeTypeName, null);
|
||||
@@ -492,7 +492,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined data type object that doesn't exist with active connection. Expect null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedDataTypeDefinitionWithNonExistentFailureTest()
|
||||
{
|
||||
string objectName = "doesNotExist";
|
||||
@@ -504,7 +504,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined table type object with active connection and explicit schema name. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedTableTypeDefinitionWithSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(LocationTableTypeQuery, LocationTableTypeName, UserDefinedTableTypeTypeName);
|
||||
@@ -513,7 +513,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined table type object with active connection. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedTableTypeDefinitionWithoutSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(LocationTableTypeQuery, LocationTableTypeName, UserDefinedTableTypeTypeName, null);
|
||||
@@ -522,7 +522,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a user defined table type object that doesn't exist with active connection. Expect null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetUserDefinedTableTypeDefinitionWithNonExistentFailureTest()
|
||||
{
|
||||
string objectName = "doesNotExist";
|
||||
@@ -535,7 +535,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a synonym object with active connection and explicit schema name. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetSynonymDefinitionWithSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(TestTableSynonymQuery, TestTableSynonymName, SynonymTypeName);
|
||||
@@ -545,7 +545,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a Synonym object with active connection. Expect non-null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetSynonymDefinitionWithoutSchemaNameSuccessTest()
|
||||
{
|
||||
await ExecuteAndValidatePeekTest(TestTableSynonymQuery, TestTableSynonymName, SynonymTypeName, null);
|
||||
@@ -554,7 +554,7 @@ GO";
|
||||
/// <summary>
|
||||
/// Test get definition for a Synonym object that doesn't exist with active connection. Expect null locations
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task GetSynonymDefinitionWithNonExistentFailureTest()
|
||||
{
|
||||
string objectName = "doesNotExist";
|
||||
@@ -567,7 +567,7 @@ GO";
|
||||
/// Test get definition using declaration type for a view object with active connection
|
||||
/// Expect a non-null result with location
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionUsingDeclarationTypeWithValidObjectTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -589,7 +589,7 @@ GO";
|
||||
/// Test get definition using declaration type for a non existent view object with active connection
|
||||
/// Expect a non-null result with location
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionUsingDeclarationTypeWithNonexistentObjectTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -608,7 +608,7 @@ GO";
|
||||
/// Test get definition using quickInfo text for a view object with active connection
|
||||
/// Expect a non-null result with location
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionUsingQuickInfoTextWithValidObjectTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -631,7 +631,7 @@ GO";
|
||||
/// Test get definition using quickInfo text for a view object with active connection
|
||||
/// Expect a non-null result with location
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDefinitionUsingQuickInfoTextWithNonexistentObjectTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -652,7 +652,7 @@ GO";
|
||||
/// Given that there is no query connection
|
||||
/// Expect database name to be "master"
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDatabaseWithNoQueryConnectionTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -663,7 +663,7 @@ GO";
|
||||
|
||||
Scripter scripter = new Scripter(serverConnection, connInfo);
|
||||
//Check if database name is the default server connection database name
|
||||
Assert.Equal(scripter.Database.Name, "master");
|
||||
Assert.AreEqual("master", scripter.Database.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -671,7 +671,7 @@ GO";
|
||||
/// Give that there is a query connection
|
||||
/// Expect database name to be query connection's database name
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetDatabaseWithQueryConnectionTest()
|
||||
{
|
||||
ConnectionInfo connInfo = LiveConnectionHelper.InitLiveConnectionInfoForDefinition();
|
||||
@@ -686,7 +686,7 @@ GO";
|
||||
|
||||
Scripter scripter = new Scripter(serverConnection, connInfo);
|
||||
//Check if database name is the database name in the query connection
|
||||
Assert.Equal(scripter.Database.Name, "testdb");
|
||||
Assert.AreEqual("testdb", scripter.Database.Name);
|
||||
|
||||
// remove mock from ConnectionInfo
|
||||
Assert.True(connInfo.ConnectionTypeToConnectionMap.TryRemove(ConnectionType.Query, out connection));
|
||||
@@ -698,8 +698,8 @@ GO";
|
||||
/// Get Definition for a object by putting the cursor on 3 different
|
||||
/// objects
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void GetDefinitionFromChildrenAndParents()
|
||||
[Test]
|
||||
public async Task GetDefinitionFromChildrenAndParents()
|
||||
{
|
||||
string queryString = "select * from master.sys.objects";
|
||||
// place the cursor on every token
|
||||
@@ -743,8 +743,8 @@ GO";
|
||||
Assert.NotNull(masterResult);
|
||||
|
||||
// And I expect the all results to be the same
|
||||
Assert.True(CompareLocations(objectResult.Locations, sysResult.Locations));
|
||||
Assert.True(CompareLocations(objectResult.Locations, masterResult.Locations));
|
||||
Assert.That(objectResult.Locations, Is.EqualTo(sysResult.Locations), "objectResult and sysResult Locations");
|
||||
Assert.That(objectResult.Locations, Is.EqualTo(masterResult.Locations), "objectResult and masterResult Locations");
|
||||
|
||||
Cleanup(objectResult.Locations);
|
||||
Cleanup(sysResult.Locations);
|
||||
@@ -753,8 +753,8 @@ GO";
|
||||
connInfo.RemoveAllConnections();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void GetDefinitionFromProcedures()
|
||||
[Test]
|
||||
public async Task GetDefinitionFromProcedures()
|
||||
{
|
||||
|
||||
string queryString = "EXEC master.dbo.sp_MSrepl_startup";
|
||||
|
||||
@@ -17,7 +17,7 @@ using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata
|
||||
@@ -70,7 +70,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata
|
||||
/// <summary>
|
||||
/// Verify that the metadata service correctly returns details for user tables
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void MetadataReturnsUserTable()
|
||||
{
|
||||
this.testTableName += new Random().Next(1000000, 9999999).ToString();
|
||||
@@ -100,8 +100,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata
|
||||
DeleteTestTable(sqlConn);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void GetTableInfoReturnsValidResults()
|
||||
[Test]
|
||||
public async Task GetTableInfoReturnsValidResults()
|
||||
{
|
||||
this.testTableName += new Random().Next(1000000, 9999999).ToString();
|
||||
|
||||
@@ -127,8 +127,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata
|
||||
requestContext.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void GetViewInfoReturnsValidResults()
|
||||
[Test]
|
||||
public async Task GetViewInfoReturnsValidResults()
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
var requestContext = new Mock<RequestContext<TableMetadataResult>>();
|
||||
@@ -146,8 +146,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata
|
||||
requestContext.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyMetadataList()
|
||||
[Test]
|
||||
public async Task VerifyMetadataList()
|
||||
{
|
||||
string query = @"CREATE TABLE testTable1 (c1 int)
|
||||
GO
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="System.Net.Http"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" />
|
||||
<PackageReference Include="nunit" />
|
||||
<PackageReference Include="nunit3testadapter" />
|
||||
<PackageReference Include="nunit.console" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
|
||||
@@ -17,7 +17,7 @@ using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common.Baselined;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common.Extensions;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.ObjectExplorer.ObjectExplorerService;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
@@ -26,8 +26,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
{
|
||||
private ObjectExplorerService _service = TestServiceProvider.Instance.ObjectExplorerService;
|
||||
|
||||
[Fact]
|
||||
public async void CreateSessionAndExpandOnTheServerShouldReturnServerAsTheRoot()
|
||||
[Test]
|
||||
public async Task CreateSessionAndExpandOnTheServerShouldReturnServerAsTheRoot()
|
||||
{
|
||||
var query = "";
|
||||
string databaseName = null;
|
||||
@@ -37,8 +37,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void CreateSessionWithTempdbAndExpandOnTheServerShouldReturnServerAsTheRoot()
|
||||
[Test]
|
||||
public async Task CreateSessionWithTempdbAndExpandOnTheServerShouldReturnServerAsTheRoot()
|
||||
{
|
||||
var query = "";
|
||||
string databaseName = "tempdb";
|
||||
@@ -48,8 +48,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyServerLogins()
|
||||
[Test]
|
||||
public async Task VerifyServerLogins()
|
||||
{
|
||||
var query = $@"If Exists (select loginname from master.dbo.syslogins
|
||||
where name = 'OEServerLogin')
|
||||
@@ -77,8 +77,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyServerTriggers()
|
||||
[Test]
|
||||
public async Task VerifyServerTriggers()
|
||||
{
|
||||
var query = @"IF EXISTS (SELECT * FROM sys.server_triggers WHERE name = 'OE_ddl_trig_database')
|
||||
|
||||
@@ -113,8 +113,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void CreateSessionAndExpandOnTheDatabaseShouldReturnDatabaseAsTheRoot()
|
||||
[Test]
|
||||
public async Task CreateSessionAndExpandOnTheDatabaseShouldReturnDatabaseAsTheRoot()
|
||||
{
|
||||
var query = "";
|
||||
string databaseName = "#testDb#";
|
||||
@@ -124,8 +124,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RefreshNodeShouldGetTheDataFromDatabase()
|
||||
[Test]
|
||||
public async Task RefreshNodeShouldGetTheDataFromDatabase()
|
||||
{
|
||||
var query = "Create table t1 (c1 int)";
|
||||
string databaseName = "#testDb#";
|
||||
@@ -148,8 +148,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
/// Create a test database with prefix (OfflineDb). Create an oe session for master db and expand the new test db.
|
||||
/// The expand should return an error that says database if offline
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ExpandOfflineDatabaseShouldReturnError()
|
||||
[Test]
|
||||
public async Task ExpandOfflineDatabaseShouldReturnError()
|
||||
{
|
||||
var query = "ALTER DATABASE {0} SET OFFLINE WITH ROLLBACK IMMEDIATE";
|
||||
string databaseName = "master";
|
||||
@@ -162,8 +162,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RefreshShouldCleanTheCache()
|
||||
[Test]
|
||||
public async Task RefreshShouldCleanTheCache()
|
||||
{
|
||||
string query = @"Create table t1 (c1 int)
|
||||
GO
|
||||
@@ -220,7 +220,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
var tableChildren = (await _service.ExpandNode(session, tablePath, true)).Nodes;
|
||||
|
||||
//Verify table is not returned
|
||||
Assert.Equal(tableChildren.Any(t => t.Label == tableName), !deleted);
|
||||
Assert.AreEqual(tableChildren.Any(t => t.Label == tableName), !deleted);
|
||||
|
||||
//Verify tables cache has items
|
||||
rootChildrenCache = session.Root.GetChildren();
|
||||
@@ -228,8 +228,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
Assert.True(tablesCache.Any());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyAllSqlObjects()
|
||||
[Test]
|
||||
public async Task VerifyAllSqlObjects()
|
||||
{
|
||||
var queryFileName = "AllSqlObjects.sql";
|
||||
string baselineFileName = "AllSqlObjects.txt";
|
||||
@@ -237,9 +237,9 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
await TestServiceProvider.CalculateRunTime(() => VerifyObjectExplorerTest(databaseName, "AllSqlObjects", queryFileName, baselineFileName), true);
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
//[Test]
|
||||
//This takes take long to run so not a good test for CI builds
|
||||
public async void VerifySystemObjects()
|
||||
public async Task VerifySystemObjects()
|
||||
{
|
||||
string queryFileName = null;
|
||||
string baselineFileName = null;
|
||||
@@ -299,19 +299,19 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
Assert.NotNull(session);
|
||||
Assert.NotNull(session.Root);
|
||||
NodeInfo nodeInfo = session.Root.ToNodeInfo();
|
||||
Assert.Equal(nodeInfo.IsLeaf, false);
|
||||
Assert.AreEqual(false, nodeInfo.IsLeaf);
|
||||
|
||||
NodeInfo databaseNode = null;
|
||||
|
||||
if (serverNode)
|
||||
{
|
||||
Assert.Equal(nodeInfo.NodeType, NodeTypes.Server.ToString());
|
||||
Assert.AreEqual(nodeInfo.NodeType, NodeTypes.Server.ToString());
|
||||
var children = session.Root.Expand(new CancellationToken());
|
||||
|
||||
//All server children should be folder nodes
|
||||
foreach (var item in children)
|
||||
{
|
||||
Assert.Equal(item.NodeType, "Folder");
|
||||
Assert.AreEqual("Folder", item.NodeType);
|
||||
}
|
||||
|
||||
var databasesRoot = children.FirstOrDefault(x => x.NodeTypeId == NodeTypes.Databases);
|
||||
@@ -331,7 +331,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal(nodeInfo.NodeType, NodeTypes.Database.ToString());
|
||||
Assert.AreEqual(nodeInfo.NodeType, NodeTypes.Database.ToString());
|
||||
databaseNode = session.Root.ToNodeInfo();
|
||||
Assert.True(databaseNode.Label.Contains(databaseName));
|
||||
var databasesChildren = (await _service.ExpandNode(session, databaseNode.NodePath)).Nodes;
|
||||
@@ -347,15 +347,15 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer
|
||||
Assert.NotNull(session);
|
||||
Assert.NotNull(session.Root);
|
||||
NodeInfo nodeInfo = session.Root.ToNodeInfo();
|
||||
Assert.Equal(nodeInfo.IsLeaf, false);
|
||||
Assert.Equal(nodeInfo.NodeType, NodeTypes.Database.ToString());
|
||||
Assert.AreEqual(false, nodeInfo.IsLeaf);
|
||||
Assert.AreEqual(nodeInfo.NodeType, NodeTypes.Database.ToString());
|
||||
Assert.True(nodeInfo.Label.Contains(databaseName));
|
||||
var children = (await _service.ExpandNode(session, session.Root.GetNodePath())).Nodes;
|
||||
|
||||
//All server children should be folder nodes
|
||||
foreach (var item in children)
|
||||
{
|
||||
Assert.Equal(item.NodeType, "Folder");
|
||||
Assert.AreEqual("Folder", item.NodeType);
|
||||
}
|
||||
|
||||
var tablesRoot = children.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_Tables);
|
||||
|
||||
@@ -18,7 +18,7 @@ using Microsoft.SqlTools.ServiceLayer.Profiler;
|
||||
using Microsoft.SqlTools.ServiceLayer.Profiler.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Profiler
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Profiler
|
||||
/// <summary>
|
||||
/// Verify that a start profiling request starts a profiling session
|
||||
/// </summary>
|
||||
//[Fact]
|
||||
//[Test]
|
||||
public async Task TestHandleStartAndStopProfilingRequests()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -76,7 +76,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Profiler
|
||||
/// <summary>
|
||||
/// Verify the profiler service XEvent session factory
|
||||
/// </summary>
|
||||
//[Fact]
|
||||
//[Test]
|
||||
public void TestCreateXEventSession()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Data.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataStorage
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
|
||||
/// <summary>
|
||||
/// Validate GetBytesWithMaxCapacity
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetBytesWithMaxCapacityTest()
|
||||
{
|
||||
var storageReader = GetTestStorageDataReader(
|
||||
@@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
|
||||
/// <summary>
|
||||
/// Validate GetCharsWithMaxCapacity
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetCharsWithMaxCapacityTest()
|
||||
{
|
||||
var storageReader = GetTestStorageDataReader(
|
||||
@@ -69,7 +69,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
|
||||
/// <summary>
|
||||
/// Validate GetXmlWithMaxCapacity
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void GetXmlWithMaxCapacityTest()
|
||||
{
|
||||
var storageReader = GetTestStorageDataReader(
|
||||
@@ -86,7 +86,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution.DataSt
|
||||
/// <summary>
|
||||
/// Validate StringWriterWithMaxCapacity Write test
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void StringWriterWithMaxCapacityTest()
|
||||
{
|
||||
var writer = new StorageDataReader.StringWriterWithMaxCapacity(null, 4);
|
||||
|
||||
@@ -6,19 +6,20 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
{
|
||||
public class ExecuteTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void RollbackTransactionFailsWithoutBeginTransaction()
|
||||
{
|
||||
const string refactorText = "ROLLBACK TRANSACTION";
|
||||
@@ -37,7 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
Assert.True(query.Batches[0].HasError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TransactionsSucceedAcrossQueries()
|
||||
{
|
||||
const string beginText = "BEGIN TRANSACTION";
|
||||
@@ -56,7 +57,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
Assert.False(rollbackQuery.Batches[0].HasError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TempTablesPersistAcrossQueries()
|
||||
{
|
||||
const string createTempText = "CREATE TABLE #someTempTable (id int)";
|
||||
@@ -75,7 +76,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
Assert.False(insertTempQuery.Batches[0].HasError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void DatabaseChangesWhenCallingUseDatabase()
|
||||
{
|
||||
const string master = "master";
|
||||
@@ -92,27 +93,15 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
|
||||
// If I use master, the current database should be master
|
||||
CreateAndExecuteQuery(string.Format(useQuery, master), connInfo, fileStreamFactory);
|
||||
Assert.Equal(master, connInfo.ConnectionDetails.DatabaseName);
|
||||
Assert.AreEqual(master, connInfo.ConnectionDetails.DatabaseName);
|
||||
|
||||
// If I use tempdb, the current database should be tempdb
|
||||
CreateAndExecuteQuery(string.Format(useQuery, tempdb), connInfo, fileStreamFactory);
|
||||
Assert.Equal(tempdb, connInfo.ConnectionDetails.DatabaseName);
|
||||
Assert.AreEqual(tempdb, connInfo.ConnectionDetails.DatabaseName);
|
||||
|
||||
// If I switch back to master, the current database should be master
|
||||
CreateAndExecuteQuery(string.Format(useQuery, master), connInfo, fileStreamFactory);
|
||||
Assert.Equal(master, connInfo.ConnectionDetails.DatabaseName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestBatchExecutionTime() {
|
||||
var result = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
ConnectionInfo connInfo = result.ConnectionInfo;
|
||||
var fileStreamFactory = MemoryFileSystem.GetFileStreamFactory();
|
||||
Query query = CreateAndExecuteQuery("select * from sys.databases", connInfo, fileStreamFactory);
|
||||
DateTime elapsedTime = Convert.ToDateTime(query.Batches[0].ExecutionElapsedTime);
|
||||
Query mutipleQuery = CreateAndExecuteQuery("select * from sys.databases\r\nGO 15", connInfo, fileStreamFactory);
|
||||
DateTime multipleElapsedTime = Convert.ToDateTime(mutipleQuery.Batches[0].ExecutionElapsedTime);
|
||||
Assert.True(multipleElapsedTime > elapsedTime);
|
||||
Assert.AreEqual(master, connInfo.ConnectionDetails.DatabaseName);
|
||||
}
|
||||
|
||||
public static Query CreateAndExecuteQuery(string queryText, ConnectionInfo connectionInfo, IFileStreamFactory fileStreamFactory, bool IsSqlCmd = false)
|
||||
|
||||
@@ -9,13 +9,13 @@ using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution
|
||||
{
|
||||
public class SqlCmdExecutionTest
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestConnectSqlCmdCommand()
|
||||
{
|
||||
var fileStreamFactory = MemoryFileSystem.GetFileStreamFactory();
|
||||
@@ -41,7 +41,7 @@ GO";
|
||||
Assert.True(query.Batches[0].HasError, "Query should have error");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestOnErrorSqlCmdCommand()
|
||||
{
|
||||
var fileStreamFactory = MemoryFileSystem.GetFileStreamFactory();
|
||||
@@ -73,7 +73,7 @@ GO";
|
||||
Assert.False(query.Batches[1].HasExecuted, "last batch should NOT be executed");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void TestIncludeSqlCmdCommand()
|
||||
{
|
||||
var fileStreamFactory = MemoryFileSystem.GetFileStreamFactory();
|
||||
|
||||
@@ -12,7 +12,7 @@ using Moq;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
{
|
||||
@@ -265,8 +265,8 @@ END
|
||||
{
|
||||
// validate script generation failed because there were no differences
|
||||
Assert.False(generateScriptOperation1.ScriptGenerationResult.Success);
|
||||
Assert.Equal("Performing script generation is not possible for this comparison result.", generateScriptOperation1.ScriptGenerationResult.Message);
|
||||
Assert.Equal("Performing script generation is not possible for this comparison result.", ex.Message);
|
||||
Assert.AreEqual("Performing script generation is not possible for this comparison result.", generateScriptOperation1.ScriptGenerationResult.Message);
|
||||
Assert.AreEqual("Performing script generation is not possible for this comparison result.", ex.Message);
|
||||
}
|
||||
|
||||
var schemaCompareParams2 = new SchemaCompareParams
|
||||
@@ -309,8 +309,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing two dacpacs with and without ignore column option
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDacpacToDacpacOptions()
|
||||
[Test]
|
||||
public async Task SchemaCompareDacpacToDacpacOptions()
|
||||
{
|
||||
await SendAndValidateSchemaCompareRequestDacpacToDacpacWithOptions(Source1, Target1, GetIgnoreColumnOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -318,8 +318,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing two dacpacs with and excluding table valued functions
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDacpacToDacpacObjectTypes()
|
||||
[Test]
|
||||
public async Task SchemaCompareDacpacToDacpacObjectTypes()
|
||||
{
|
||||
await SendAndValidateSchemaCompareRequestDacpacToDacpacWithOptions(Source2, Target2, GetExcludeTableValuedFunctionOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -327,8 +327,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing two databases with and without ignore column option
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDatabaseToDatabaseOptions()
|
||||
[Test]
|
||||
public async Task SchemaCompareDatabaseToDatabaseOptions()
|
||||
{
|
||||
await SendAndValidateSchemaCompareRequestDatabaseToDatabaseWithOptions(Source1, Target1, GetIgnoreColumnOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -336,8 +336,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing two databases with and excluding table valued functions
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDatabaseToDatabaseObjectTypes()
|
||||
[Test]
|
||||
public async Task SchemaCompareDatabaseToDatabaseObjectTypes()
|
||||
{
|
||||
await SendAndValidateSchemaCompareRequestDatabaseToDatabaseWithOptions(Source2, Target2, GetExcludeTableValuedFunctionOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -345,8 +345,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare script generation comparing dacpac and db with and without ignore column option
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareGenerateScriptDacpacToDatabaseOptions()
|
||||
[Test]
|
||||
public async Task SchemaCompareGenerateScriptDacpacToDatabaseOptions()
|
||||
{
|
||||
await SendAndValidateSchemaCompareGenerateScriptRequestDacpacToDatabaseWithOptions(Source1, Target1, GetIgnoreColumnOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -354,8 +354,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare script generation comparing dacpac and db with and excluding table valued function
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareGenerateScriptDacpacToDatabaseObjectTypes()
|
||||
[Test]
|
||||
public async Task SchemaCompareGenerateScriptDacpacToDatabaseObjectTypes()
|
||||
{
|
||||
await SendAndValidateSchemaCompareGenerateScriptRequestDacpacToDatabaseWithOptions(Source2, Target2, GetExcludeTableValuedFunctionOptions(), new DeploymentOptions());
|
||||
}
|
||||
@@ -363,7 +363,7 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare default creation test
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public void ValidateSchemaCompareOptionsDefaultAgainstDacFx()
|
||||
{
|
||||
DeploymentOptions deployOptions = new DeploymentOptions();
|
||||
@@ -384,8 +384,8 @@ END
|
||||
/// <summary>
|
||||
/// Verify the schema compare default creation test
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ValidateSchemaCompareGetDefaultOptionsCallFromService()
|
||||
[Test]
|
||||
public async Task ValidateSchemaCompareGetDefaultOptionsCallFromService()
|
||||
{
|
||||
DeploymentOptions deployOptions = new DeploymentOptions();
|
||||
var schemaCompareRequestContext = new Mock<RequestContext<SchemaCompareOptionsResult>>();
|
||||
|
||||
@@ -16,8 +16,9 @@ using Microsoft.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
{
|
||||
public class SchemaCompareServiceTests
|
||||
@@ -78,8 +79,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing two dacpacs
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDacpacToDacpac()
|
||||
[Test]
|
||||
public async Task SchemaCompareDacpacToDacpac()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
|
||||
@@ -122,8 +123,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing a two databases
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDatabaseToDatabase()
|
||||
[Test]
|
||||
public async Task SchemaCompareDatabaseToDatabase()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -161,8 +162,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare request comparing a database to a dacpac
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareDatabaseToDacpac()
|
||||
[Test]
|
||||
public async Task SchemaCompareDatabaseToDacpac()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -202,8 +203,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare generate script request comparing a database to a database
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareGenerateScriptDatabaseToDatabase()
|
||||
[Test]
|
||||
public async Task SchemaCompareGenerateScriptDatabaseToDatabase()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
var schemaCompareRequestContext = new Mock<RequestContext<SchemaCompareResult>>();
|
||||
@@ -249,8 +250,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare generate script request comparing a dacpac to a database
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareGenerateScriptDacpacToDatabase()
|
||||
[Test]
|
||||
public async Task SchemaCompareGenerateScriptDacpacToDatabase()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -300,8 +301,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare publish changes request comparing a dacpac to a database
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaComparePublishChangesDacpacToDatabase()
|
||||
[Test]
|
||||
public async Task SchemaComparePublishChangesDacpacToDatabase()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -349,14 +350,14 @@ WITH VALUES
|
||||
SchemaComparePublishChangesOperation publishChangesOperation = new SchemaComparePublishChangesOperation(publishChangesParams, schemaCompareOperation.ComparisonResult);
|
||||
publishChangesOperation.Execute(TaskExecutionMode.Execute);
|
||||
Assert.True(publishChangesOperation.PublishResult.Success);
|
||||
Assert.Empty(publishChangesOperation.PublishResult.Errors);
|
||||
Assert.That(publishChangesOperation.PublishResult.Errors, Is.Empty);
|
||||
|
||||
// Verify that there are no differences after the publish by running the comparison again
|
||||
schemaCompareOperation.Execute(TaskExecutionMode.Execute);
|
||||
|
||||
Assert.True(schemaCompareOperation.ComparisonResult.IsValid);
|
||||
Assert.True(schemaCompareOperation.ComparisonResult.IsEqual);
|
||||
Assert.Empty(schemaCompareOperation.ComparisonResult.Differences);
|
||||
Assert.That(schemaCompareOperation.ComparisonResult.Differences, Is.Empty);
|
||||
|
||||
// cleanup
|
||||
SchemaCompareTestUtils.VerifyAndCleanup(sourceDacpacFilePath);
|
||||
@@ -371,8 +372,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare publish changes request comparing a database to a database
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaComparePublishChangesDatabaseToDatabase()
|
||||
[Test]
|
||||
public async Task SchemaComparePublishChangesDatabaseToDatabase()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -416,14 +417,14 @@ WITH VALUES
|
||||
SchemaComparePublishChangesOperation publishChangesOperation = new SchemaComparePublishChangesOperation(publishChangesParams, schemaCompareOperation.ComparisonResult);
|
||||
publishChangesOperation.Execute(TaskExecutionMode.Execute);
|
||||
Assert.True(publishChangesOperation.PublishResult.Success);
|
||||
Assert.Empty(publishChangesOperation.PublishResult.Errors);
|
||||
Assert.That(publishChangesOperation.PublishResult.Errors, Is.Empty);
|
||||
|
||||
// Verify that there are no differences after the publish by running the comparison again
|
||||
schemaCompareOperation.Execute(TaskExecutionMode.Execute);
|
||||
|
||||
Assert.True(schemaCompareOperation.ComparisonResult.IsValid);
|
||||
Assert.True(schemaCompareOperation.ComparisonResult.IsEqual);
|
||||
Assert.Empty(schemaCompareOperation.ComparisonResult.Differences);
|
||||
Assert.That(schemaCompareOperation.ComparisonResult.Differences, Is.Empty);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -435,8 +436,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare Scmp File Save for database endpoints
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareSaveScmpFileForDatabases()
|
||||
[Test]
|
||||
public async Task SchemaCompareSaveScmpFileForDatabases()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
|
||||
@@ -465,8 +466,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare Scmp File Save for dacpac endpoints
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareSaveScmpFileForDacpacs()
|
||||
[Test]
|
||||
public async Task SchemaCompareSaveScmpFileForDacpacs()
|
||||
{
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
SqlTestDb targetDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, TargetScript, "SchemaCompareTarget");
|
||||
@@ -497,8 +498,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare Scmp File Save for dacpac and db endpoints combination
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareSaveScmpFileForDacpacToDB()
|
||||
[Test]
|
||||
public async Task SchemaCompareSaveScmpFileForDacpacToDB()
|
||||
{
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
SqlTestDb targetDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, TargetScript, "SchemaCompareTarget");
|
||||
@@ -528,8 +529,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify opening an scmp comparing two databases
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareOpenScmpDatabaseToDatabaseRequest()
|
||||
[Test]
|
||||
public async Task SchemaCompareOpenScmpDatabaseToDatabaseRequest()
|
||||
{
|
||||
await CreateAndOpenScmp(SchemaCompareEndpointType.Database, SchemaCompareEndpointType.Database);
|
||||
}
|
||||
@@ -537,8 +538,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify opening an scmp comparing a dacpac and database
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareOpenScmpDacpacToDatabaseRequest()
|
||||
[Test]
|
||||
public async Task SchemaCompareOpenScmpDacpacToDatabaseRequest()
|
||||
{
|
||||
await CreateAndOpenScmp(SchemaCompareEndpointType.Dacpac, SchemaCompareEndpointType.Database);
|
||||
}
|
||||
@@ -546,8 +547,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify opening an scmp comparing two dacpacs
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareOpenScmpDacpacToDacpacRequest()
|
||||
[Test]
|
||||
public async Task SchemaCompareOpenScmpDacpacToDacpacRequest()
|
||||
{
|
||||
await CreateAndOpenScmp(SchemaCompareEndpointType.Dacpac, SchemaCompareEndpointType.Dacpac);
|
||||
}
|
||||
@@ -555,7 +556,7 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare Service Calls ends to end
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task VerifySchemaCompareServiceCalls()
|
||||
{
|
||||
string operationId = Guid.NewGuid().ToString();
|
||||
@@ -695,8 +696,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare cancel
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareCancelCompareOperation()
|
||||
[Test]
|
||||
public async Task SchemaCompareCancelCompareOperation()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceScript, "SchemaCompareSource");
|
||||
@@ -746,8 +747,8 @@ WITH VALUES
|
||||
/// test to verify recent dacfx bugs
|
||||
/// does not need all combinations of db and dacpacs
|
||||
/// </summary>
|
||||
//[Fact] disabling the failing test is failing now.
|
||||
public async void SchemaCompareCEKAndFilegoupTest()
|
||||
//[Test] disabling the failing test is failing now.
|
||||
public async Task SchemaCompareCEKAndFilegoupTest()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, CreateKey, "SchemaCompareSource");
|
||||
@@ -819,8 +820,8 @@ WITH VALUES
|
||||
/// <summary>
|
||||
/// Verify the schema compare request with failing exclude request because of dependencies and that include will include dependencies
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void SchemaCompareIncludeExcludeWithDependencies()
|
||||
[Test]
|
||||
public async Task SchemaCompareIncludeExcludeWithDependencies()
|
||||
{
|
||||
var result = SchemaCompareTestUtils.GetLiveAutoCompleteTestObjects();
|
||||
SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, SourceIncludeExcludeScript, "SchemaCompareSource");
|
||||
@@ -1031,7 +1032,7 @@ WITH VALUES
|
||||
// create a comparison and exclude the first difference
|
||||
SchemaComparison compare = new SchemaComparison(sourceEndpoint, targetEndpoint);
|
||||
SchemaComparisonResult result = compare.Compare();
|
||||
Assert.NotEmpty(result.Differences);
|
||||
Assert.That(result.Differences, Is.Not.Empty);
|
||||
SchemaDifference difference = result.Differences.First();
|
||||
if (difference.SourceObject != null)
|
||||
{
|
||||
@@ -1059,10 +1060,10 @@ WITH VALUES
|
||||
|
||||
Assert.NotNull(schemaCompareOpenScmpOperation.Result);
|
||||
Assert.True(schemaCompareOpenScmpOperation.Result.Success);
|
||||
Assert.NotEmpty(schemaCompareOpenScmpOperation.Result.ExcludedSourceElements);
|
||||
Assert.Equal(1, schemaCompareOpenScmpOperation.Result.ExcludedSourceElements.Count());
|
||||
Assert.Empty(schemaCompareOpenScmpOperation.Result.ExcludedTargetElements);
|
||||
Assert.Equal(targetDb.DatabaseName, schemaCompareOpenScmpOperation.Result.OriginalTargetName);
|
||||
Assert.That(schemaCompareOpenScmpOperation.Result.ExcludedSourceElements, Is.Not.Empty);
|
||||
Assert.AreEqual(1, schemaCompareOpenScmpOperation.Result.ExcludedSourceElements.Count());
|
||||
Assert.That(schemaCompareOpenScmpOperation.Result.ExcludedTargetElements, Is.Empty);
|
||||
Assert.AreEqual(targetDb.DatabaseName, schemaCompareOpenScmpOperation.Result.OriginalTargetName);
|
||||
ValidateResultEndpointInfo(sourceEndpoint, schemaCompareOpenScmpOperation.Result.SourceEndpointInfo, sourceDb.ConnectionString);
|
||||
ValidateResultEndpointInfo(targetEndpoint, schemaCompareOpenScmpOperation.Result.TargetEndpointInfo, targetDb.ConnectionString);
|
||||
|
||||
@@ -1093,13 +1094,13 @@ WITH VALUES
|
||||
if (resultEndpoint.EndpointType == SchemaCompareEndpointType.Dacpac)
|
||||
{
|
||||
SchemaCompareDacpacEndpoint dacpacEndpoint = originalEndpoint as SchemaCompareDacpacEndpoint;
|
||||
Assert.Equal(dacpacEndpoint.FilePath, resultEndpoint.PackageFilePath);
|
||||
Assert.AreEqual(dacpacEndpoint.FilePath, resultEndpoint.PackageFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
SchemaCompareDatabaseEndpoint databaseEndpoint = originalEndpoint as SchemaCompareDatabaseEndpoint;
|
||||
Assert.Equal(databaseEndpoint.DatabaseName, resultEndpoint.DatabaseName);
|
||||
Assert.Contains(resultEndpoint.ConnectionDetails.ConnectionString, connectionString); // connectionString has password but resultEndpoint doesn't
|
||||
Assert.AreEqual(databaseEndpoint.DatabaseName, resultEndpoint.DatabaseName);
|
||||
Assert.That(connectionString, Does.Contain(resultEndpoint.ConnectionDetails.ConnectionString), "connectionString has password but resultEndpoint doesn't");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,20 +1118,20 @@ WITH VALUES
|
||||
|
||||
private void ValidateDiffEntryObjects(string[] diffObjectName, string diffObjectTypeType, TSqlObject dacfxObject)
|
||||
{
|
||||
Assert.Equal(dacfxObject.Name.Parts.Count, diffObjectName.Length);
|
||||
Assert.AreEqual(dacfxObject.Name.Parts.Count, diffObjectName.Length);
|
||||
for (int i = 0; i < diffObjectName.Length; i++)
|
||||
{
|
||||
Assert.Equal(dacfxObject.Name.Parts[i], diffObjectName[i]);
|
||||
Assert.AreEqual(dacfxObject.Name.Parts[i], diffObjectName[i]);
|
||||
}
|
||||
|
||||
var dacFxExcludedObject = new SchemaComparisonExcludedObjectId(dacfxObject.ObjectType, dacfxObject.Name);
|
||||
var excludedObject = new SchemaComparisonExcludedObjectId(diffObjectTypeType, new ObjectIdentifier(diffObjectName));
|
||||
|
||||
Assert.Equal(dacFxExcludedObject.Identifier.ToString(), excludedObject.Identifier.ToString());
|
||||
Assert.Equal(dacFxExcludedObject.TypeName, excludedObject.TypeName);
|
||||
Assert.AreEqual(dacFxExcludedObject.Identifier.ToString(), excludedObject.Identifier.ToString());
|
||||
Assert.AreEqual(dacFxExcludedObject.TypeName, excludedObject.TypeName);
|
||||
|
||||
string dacFxType = dacFxExcludedObject.TypeName;
|
||||
Assert.Equal(dacFxType, diffObjectTypeType);
|
||||
Assert.AreEqual(dacFxType, diffObjectTypeType);
|
||||
}
|
||||
|
||||
private void CreateAndValidateScmpFile(SchemaCompareEndpointInfo sourceInfo, SchemaCompareEndpointInfo targetInfo, bool isSourceDb, bool isTargetDb)
|
||||
@@ -1236,7 +1237,8 @@ WITH VALUES
|
||||
|
||||
private void ValidateTask(string expectedTaskName)
|
||||
{
|
||||
int retry = 5;
|
||||
// upped the retry count to 20 so tests pass against remote servers more readily
|
||||
int retry = 20;
|
||||
Assert.True(TaskService.Instance.TaskManager.Tasks.Count == 1, $"Expected 1 task but found {TaskService.Instance.TaskManager.Tasks.Count} tasks");
|
||||
while (TaskService.Instance.TaskManager.Tasks.Any() && retry > 0)
|
||||
{
|
||||
@@ -1259,6 +1261,7 @@ WITH VALUES
|
||||
retry--;
|
||||
}
|
||||
Assert.False(TaskService.Instance.TaskManager.Tasks.Any(), $"No tasks were expected to exist but had {TaskService.Instance.TaskManager.Tasks.Count} [{string.Join(",", TaskService.Instance.TaskManager.Tasks.Select(t => t.TaskId))}]");
|
||||
Console.WriteLine($"ValidateTask{expectedTaskName} completed at retry = {retry}");
|
||||
TaskService.Instance.TaskManager.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
@@ -76,8 +76,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
/// <summary>
|
||||
/// Verify the script object request
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ScriptingScript()
|
||||
[Test]
|
||||
public async Task ScriptingScript()
|
||||
{
|
||||
foreach (string obj in objects)
|
||||
{
|
||||
@@ -86,8 +86,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsCreateTable()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsCreateTable()
|
||||
{
|
||||
string query = @"CREATE TABLE testTable1 (c1 int)
|
||||
GO
|
||||
@@ -110,8 +110,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAsForMultipleObjects(query, new List<ScriptingObject> { scriptingObject }, scriptCreateDrop, expectedScripts);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsExecuteTableFailes()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsExecuteTableFailes()
|
||||
{
|
||||
string query = "CREATE TABLE testTable1 (c1 int)";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Execute;
|
||||
@@ -125,8 +125,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsAlter()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsAlter()
|
||||
{
|
||||
string query = @"CREATE PROCEDURE testSp1 @StartProductID [int] AS BEGIN Select * from sys.all_columns END
|
||||
GO
|
||||
@@ -168,8 +168,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
}
|
||||
|
||||
// TODO: Fix flaky test. See https://github.com/Microsoft/sqltoolsservice/issues/631
|
||||
// [Fact]
|
||||
public async void VerifyScriptAsExecuteStoredProcedure()
|
||||
// [Test]
|
||||
public async Task VerifyScriptAsExecuteStoredProcedure()
|
||||
{
|
||||
string query = @"CREATE PROCEDURE testSp1
|
||||
@BusinessEntityID [int],
|
||||
@@ -192,8 +192,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsSelectTable()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsSelectTable()
|
||||
{
|
||||
string query = "CREATE TABLE testTable1 (c1 int)";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Select;
|
||||
@@ -208,8 +208,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsCreateView()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsCreateView()
|
||||
{
|
||||
string query = "CREATE VIEW testView1 AS SELECT * from sys.all_columns";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Create;
|
||||
@@ -224,8 +224,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsCreateStoredProcedure()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsCreateStoredProcedure()
|
||||
{
|
||||
string query = "CREATE PROCEDURE testSp1 AS BEGIN Select * from sys.all_columns END";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Create;
|
||||
@@ -240,8 +240,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsDropTable()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsDropTable()
|
||||
{
|
||||
string query = "CREATE TABLE testTable1 (c1 int)";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Delete;
|
||||
@@ -256,8 +256,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsDropView()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsDropView()
|
||||
{
|
||||
string query = "CREATE VIEW testView1 AS SELECT * from sys.all_columns";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Delete;
|
||||
@@ -272,8 +272,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
||||
await VerifyScriptAs(query, scriptingObject, scriptCreateDrop, expectedScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyScriptAsDropStoredProcedure()
|
||||
[Test]
|
||||
public async Task VerifyScriptAsDropStoredProcedure()
|
||||
{
|
||||
string query = "CREATE PROCEDURE testSp1 AS BEGIN Select * from sys.all_columns END";
|
||||
ScriptingOperationType scriptCreateDrop = ScriptingOperationType.Delete;
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.SqlTools.ServiceLayer.Security.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
/// <summary>
|
||||
/// TestHandleCreateCredentialRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleCreateCredentialRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
/// <summary>
|
||||
/// TestHandleUpdateCredentialRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleUpdateCredentialRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
@@ -72,7 +72,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Security
|
||||
/// <summary>
|
||||
/// TestHandleDeleteCredentialRequest
|
||||
/// </summary>
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task TestHandleDeleteCredentialRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -13,22 +13,22 @@ using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.MachineLearningServices
|
||||
{
|
||||
public class ServerConfigurationsServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public async void VerifyListingConfigs()
|
||||
[Test]
|
||||
public async Task VerifyListingConfigs()
|
||||
{
|
||||
List<ServerConfigProperty> configs = await GetAllConfigs();
|
||||
Assert.NotNull(configs);
|
||||
Assert.True(configs.Count > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyUpdatingConfigs()
|
||||
[Test]
|
||||
public async Task VerifyUpdatingConfigs()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
@@ -59,14 +59,14 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.MachineLearningServic
|
||||
|
||||
await ServerConfigService.Instance.HandleServerConfigViewRequest(requestParams, requestContext.Object);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(result.ConfigProperty.ConfigValue, sampleConfig.ConfigValue);
|
||||
Assert.AreEqual(result.ConfigProperty.ConfigValue, sampleConfig.ConfigValue);
|
||||
await ServerConfigService.Instance.HandleServerConfigUpdateRequest(updateRequestParams, updateRequestContext.Object);
|
||||
Assert.NotNull(updateResult);
|
||||
Assert.Equal(updateResult.ConfigProperty.ConfigValue, newValue);
|
||||
Assert.AreEqual(updateResult.ConfigProperty.ConfigValue, newValue);
|
||||
updateRequestParams.ConfigValue = sampleConfig.ConfigValue;
|
||||
await ServerConfigService.Instance.HandleServerConfigUpdateRequest(updateRequestParams, updateRequestContext.Object);
|
||||
Assert.NotNull(updateResult);
|
||||
Assert.Equal(updateResult.ConfigProperty.ConfigValue, sampleConfig.ConfigValue);
|
||||
Assert.AreEqual(updateResult.ConfigProperty.ConfigValue, sampleConfig.ConfigValue);
|
||||
ServerConfigService.Instance.ConnectionServiceInstance.Disconnect(new DisconnectParams
|
||||
{
|
||||
OwnerUri = queryTempFile.FilePath,
|
||||
@@ -97,8 +97,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.MachineLearningServic
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async void VerifyConfigViewRequestSendErrorGivenInvalidConnection()
|
||||
[Test]
|
||||
public async Task VerifyConfigViewRequestSendErrorGivenInvalidConnection()
|
||||
{
|
||||
ServerConfigViewResponseParams result = null;
|
||||
var requestContext = RequestContextMocks.Create<ServerConfigViewResponseParams>(r => result = r).AddErrorHandling(null);
|
||||
@@ -113,8 +113,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.MachineLearningServic
|
||||
requestContext.Verify(x => x.SendError(It.IsAny<Exception>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyConfigUpdateRequestSendErrorGivenInvalidConnection()
|
||||
[Test]
|
||||
public async Task VerifyConfigUpdateRequestSendErrorGivenInvalidConnection()
|
||||
{
|
||||
ServerConfigUpdateResponseParams result = null;
|
||||
var requestContext = RequestContextMocks.Create<ServerConfigUpdateResponseParams>(r => result = r).AddErrorHandling(null);
|
||||
@@ -130,8 +130,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.MachineLearningServic
|
||||
requestContext.Verify(x => x.SendError(It.IsAny<Exception>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void VerifyConfigListRequestSendErrorGivenInvalidConnection()
|
||||
[Test]
|
||||
public async Task VerifyConfigListRequestSendErrorGivenInvalidConnection()
|
||||
{
|
||||
ServerConfigListResponseParams result = null;
|
||||
var requestContext = RequestContextMocks.Create<ServerConfigListResponseParams>(r => result = r).AddErrorHandling(null);
|
||||
|
||||
@@ -20,8 +20,6 @@ using Microsoft.SqlTools.ServiceLayer.SqlAssessment;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlAssessment.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using NUnit.Framework;
|
||||
using Xunit;
|
||||
using Assert = Xunit.Assert;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
{
|
||||
@@ -31,8 +29,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
|
||||
private static readonly string[] AllowedSeverityLevels = { "Information", "Warning", "Critical" };
|
||||
|
||||
[Fact]
|
||||
public async void InvokeSqlAssessmentServerTest()
|
||||
[Test]
|
||||
public async Task InvokeSqlAssessmentServerTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
|
||||
@@ -46,23 +44,19 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
SqlObjectType.Server,
|
||||
liveConnection);
|
||||
|
||||
Assert.All(
|
||||
response.Items,
|
||||
i =>
|
||||
{
|
||||
Assert.NotNull(i.Message);
|
||||
Assert.NotEmpty(i.Message);
|
||||
Assert.Equal(serverInfo.ServerName, i.TargetName);
|
||||
|
||||
if (i.Kind == 0)
|
||||
{
|
||||
AssertInfoPresent(i);
|
||||
}
|
||||
});
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(response.Items.Select(i => i.Message), Has.All.Not.Null.Or.Empty);
|
||||
Assert.That(response.Items.Select(i => i.TargetName), Has.All.EqualTo(serverInfo.ServerName));
|
||||
foreach (var i in response.Items.Where(i => i.Kind == 0))
|
||||
{
|
||||
AssertInfoPresent(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void GetAssessmentItemsServerTest()
|
||||
[Test]
|
||||
public async Task GetAssessmentItemsServerTest()
|
||||
{
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master");
|
||||
|
||||
@@ -76,17 +70,18 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
SqlObjectType.Server,
|
||||
liveConnection);
|
||||
|
||||
Assert.All(
|
||||
response.Items,
|
||||
i =>
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(response.Items.Select(i => i.TargetName), Has.All.EqualTo(serverInfo.ServerName));
|
||||
foreach (var i in response.Items)
|
||||
{
|
||||
AssertInfoPresent(i);
|
||||
Assert.Equal(serverInfo.ServerName, i.TargetName);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void GetAssessmentItemsDatabaseTest()
|
||||
[Test]
|
||||
public async Task GetAssessmentItemsDatabaseTest()
|
||||
{
|
||||
const string DatabaseName = "tempdb";
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo(DatabaseName);
|
||||
@@ -95,17 +90,18 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
SqlObjectType.Database,
|
||||
liveConnection);
|
||||
|
||||
Assert.All(
|
||||
response.Items,
|
||||
i =>
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(response.Items.Select(i => i.TargetName), Has.All.EndsWith(":" + DatabaseName));
|
||||
foreach (var i in response.Items)
|
||||
{
|
||||
StringAssert.EndsWith(":" + DatabaseName, i.TargetName);
|
||||
AssertInfoPresent(i);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void InvokeSqlAssessmentIDatabaseTest()
|
||||
[Test]
|
||||
public async Task InvokeSqlAssessmentIDatabaseTest()
|
||||
{
|
||||
const string DatabaseName = "tempdb";
|
||||
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo(DatabaseName);
|
||||
@@ -114,19 +110,15 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
SqlObjectType.Database,
|
||||
liveConnection);
|
||||
|
||||
Assert.All(
|
||||
response.Items,
|
||||
i =>
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(response.Items.Select(i => i.Message), Has.All.Not.Null.Or.Empty);
|
||||
Assert.That(response.Items.Select(i => i.TargetName), Has.All.EndsWith(":" + DatabaseName));
|
||||
foreach (var i in response.Items.Where(i => i.Kind == 0))
|
||||
{
|
||||
StringAssert.EndsWith(":" + DatabaseName, i.TargetName);
|
||||
Assert.NotNull(i.Message);
|
||||
Assert.NotEmpty(i.Message);
|
||||
|
||||
if (i.Kind == 0)
|
||||
{
|
||||
AssertInfoPresent(i);
|
||||
}
|
||||
});
|
||||
AssertInfoPresent(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static async Task<AssessmentResult<TResult>> CallAssessment<TResult>(
|
||||
@@ -176,13 +168,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
Assert.NotNull(response);
|
||||
if (response.Success)
|
||||
{
|
||||
Assert.All(
|
||||
response.Items,
|
||||
i =>
|
||||
{
|
||||
Assert.Equal(sqlObjectType, i.TargetType);
|
||||
Assert.Contains(i.Level, AllowedSeverityLevels);
|
||||
});
|
||||
Assert.That(response.Items.Select(i => i.TargetType), Has.All.EqualTo(sqlObjectType));
|
||||
Assert.That(response.Items.Select(i => i.Level), Has.All.AnyOf(AllowedSeverityLevels));
|
||||
}
|
||||
|
||||
return response;
|
||||
@@ -225,17 +212,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SqlAssessment
|
||||
|
||||
private void AssertInfoPresent(AssessmentItemInfo item)
|
||||
{
|
||||
Assert.NotNull(item.CheckId);
|
||||
Assert.NotEmpty(item.CheckId);
|
||||
Assert.NotNull(item.DisplayName);
|
||||
Assert.NotEmpty(item.DisplayName);
|
||||
Assert.NotNull(item.Description);
|
||||
Assert.NotEmpty(item.Description);
|
||||
Assert.NotNull(item.Tags);
|
||||
Assert.All(item.Tags, t =>
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.NotNull(t);
|
||||
Assert.NotEmpty(t);
|
||||
Assert.That(item.CheckId, Is.Not.Null.Or.Empty);
|
||||
Assert.That(item.DisplayName, Is.Not.Null.Or.Empty);
|
||||
Assert.That(item.Description, Is.Not.Null.Or.Empty);
|
||||
Assert.NotNull(item.Tags);
|
||||
Assert.That(item.Tags, Has.All.Not.Null.Or.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.UnitTests;
|
||||
using Microsoft.SqlTools.ServiceLayer.UnitTests.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TaskServices
|
||||
@@ -37,25 +37,25 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TaskServices
|
||||
service.InitializeService(serviceHostMock.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task VerifyTaskExecuteTheQueryGivenExecutionModeExecute()
|
||||
{
|
||||
await VerifyTaskWithExecutionMode(TaskExecutionMode.Execute);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task VerifyTaskGenerateScriptOnlyGivenExecutionModeScript()
|
||||
{
|
||||
await VerifyTaskWithExecutionMode(TaskExecutionMode.Script);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task VerifyTaskNotExecuteAndGenerateScriptGivenExecutionModeExecuteAndScript()
|
||||
{
|
||||
await VerifyTaskWithExecutionMode(TaskExecutionMode.ExecuteAndScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public async Task VerifyTaskSendsFailureNotificationGivenInvalidQuery()
|
||||
{
|
||||
await VerifyTaskWithExecutionMode(TaskExecutionMode.ExecuteAndScript, true);
|
||||
@@ -103,7 +103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TaskServices
|
||||
bool expected = executionMode == TaskExecutionMode.Execute || executionMode == TaskExecutionMode.ExecuteAndScript;
|
||||
Server serverToverfiy = CreateServerObject(connectionResult.ConnectionInfo);
|
||||
bool actual = serverToverfiy.Databases[testDb.DatabaseName].Tables.Contains(taskOperation.TableName, "test");
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user