mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-26 17:24:21 -05:00
Fix invalid dacpac version crashing sqltoolsservice (#789)
* fix invalid dacpac version crashing sqltoolsservice
This commit is contained in:
@@ -132,7 +132,7 @@ CREATE TABLE [dbo].[table3]
|
||||
DatabaseName = testdb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", testdb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = new Version(1, 0)
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
DacFxService service = new DacFxService();
|
||||
@@ -162,7 +162,7 @@ CREATE TABLE [dbo].[table3]
|
||||
DatabaseName = sourceDb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", sourceDb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = new Version(1, 0)
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
DacFxService service = new DacFxService();
|
||||
@@ -233,6 +233,8 @@ CREATE TABLE [dbo].[table3]
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<Mock<RequestContext<DacFxResult>>> SendAndValidateGenerateDeployScriptRequest()
|
||||
{
|
||||
// first extract a dacpac
|
||||
@@ -249,7 +251,7 @@ CREATE TABLE [dbo].[table3]
|
||||
DatabaseName = sourceDb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", sourceDb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = new Version(1, 0)
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
DacFxService service = new DacFxService();
|
||||
@@ -295,7 +297,7 @@ CREATE TABLE [dbo].[table3]
|
||||
DatabaseName = sourceDb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", sourceDb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = new Version(1, 0)
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
ExtractOperation extractOperation = new ExtractOperation(extractParams, result.ConnectionInfo);
|
||||
|
||||
@@ -369,7 +369,7 @@ CREATE TABLE [dbo].[table3]
|
||||
DatabaseName = testdb.DatabaseName,
|
||||
PackageFilePath = Path.Combine(folderPath, string.Format("{0}.dacpac", testdb.DatabaseName)),
|
||||
ApplicationName = "test",
|
||||
ApplicationVersion = new Version(1, 0)
|
||||
ApplicationVersion = "1.0.0.0"
|
||||
};
|
||||
|
||||
DacFxService service = new DacFxService();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DacFx
|
||||
{
|
||||
public class DacFxTests
|
||||
{
|
||||
[Fact]
|
||||
public void ExtractParseVersionShouldThrowExceptionGivenInvalidVersion()
|
||||
{
|
||||
string invalidVersion = "invalidVerison";
|
||||
Assert.Throws<ArgumentException>(() => ExtractOperation.ParseVersion(invalidVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user