mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-28 01:25:44 -05:00
Feature/schemacompare options (#798)
* Initial working code for schema compare options * Removing the unnecessary default value attribute * Cleaning up tests * Taking PR comments * Taking name change for Schema Compare Options --> Deployment Options * Remove parent to avoid circular reference (to avoid issues with serialization)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
{
|
||||
internal static class SchemaCompareTestUtils
|
||||
{
|
||||
internal static void VerifyAndCleanup(string filePath)
|
||||
{
|
||||
// Verify it was created
|
||||
Assert.True(File.Exists(filePath));
|
||||
|
||||
// Remove the file
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string CreateDacpac(SqlTestDb testdb)
|
||||
{
|
||||
var result = GetLiveAutoCompleteTestObjects();
|
||||
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SchemaCompareTest");
|
||||
Directory.CreateDirectory(folderPath);
|
||||
|
||||
var extractParams = new ExtractParams
|
||||
{
|
||||
DatabaseName = testdb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", testdb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
DacFxService service = new DacFxService();
|
||||
ExtractOperation operation = new ExtractOperation(extractParams, result.ConnectionInfo);
|
||||
service.PerformOperation(operation);
|
||||
|
||||
return extractParams.PackageFilePath;
|
||||
}
|
||||
|
||||
internal static LiveConnectionHelper.TestConnectionResult GetLiveAutoCompleteTestObjects()
|
||||
{
|
||||
var result = LiveConnectionHelper.InitLiveConnectionInfo();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user