mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Adding support for database literal references for Dacpac and SqlProj references (#1858)
* fixing up some nullable spots * Adding database literal support * Adding tests and support for same database refs * Fixing test * merge laggard * Split database reference tests up * PR feedback * Normalizing strings for cross-plat test passing * Updating Projects nuget package * Fixing up test
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// 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.SqlProjects.Contracts;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.SqlProjects
|
||||
{
|
||||
public class SqlProjectTests
|
||||
{
|
||||
[Test]
|
||||
public void DatabaseReferenceValidationTest()
|
||||
{
|
||||
// Verify that Validate() throws when both DatabaseLiteral and DatabaseVariable are set
|
||||
AddUserDatabaseReferenceParams reference = new AddDacpacReferenceParams() // any concrete class will do
|
||||
{
|
||||
DatabaseLiteral = "DatabaseName",
|
||||
DatabaseVariable = "$(DatabaseVariable)"
|
||||
};
|
||||
|
||||
Assert.Throws<ArgumentException>(() => reference.Validate(), $"Validate() for a reference with both {nameof(reference.DatabaseLiteral)} and {nameof(reference.DatabaseVariable)} should have failed");
|
||||
|
||||
// Verify that Validate() passes any other time
|
||||
reference = new AddDacpacReferenceParams() { DatabaseLiteral = "DatabaseName" };
|
||||
reference.Validate();
|
||||
|
||||
reference = new AddDacpacReferenceParams() { DatabaseVariable = "$(DatabaseVariable)" };
|
||||
reference.Validate();
|
||||
|
||||
reference = new AddDacpacReferenceParams();
|
||||
reference.Validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user