mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 17:23:27 -05:00
edit/createRow Default Values (#266)
Returns strings for the default value of a column when a new row is created. The values that could come back: * `null` when there isn't a default for the column * a string when there is a default for the column * a placeholder (currently <TBD>) when the column cannot be updated * Renaming EditTableMetadata to reflect its SMO source * Implementation of returning default values * Unit test for default values * Reworking column defaults using default constraints * Adding unit test for new sql script unwrapper * Disabling flaky test * Fixing oddities in tests, removing personal tests * Fixing broken unit test
This commit is contained in:
@@ -11,7 +11,7 @@ using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Utility
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Utility
|
||||
{
|
||||
public class SqlScriptFormatterTests
|
||||
{
|
||||
@@ -308,6 +308,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Utility
|
||||
|
||||
#endregion
|
||||
|
||||
[Theory]
|
||||
[InlineData("(0)", "0")]
|
||||
[InlineData("((0))", "0")]
|
||||
[InlineData("('')", "")]
|
||||
[InlineData("('stuff')", "stuff")]
|
||||
[InlineData("(N'')", "")]
|
||||
[InlineData("(N'stuff')", "stuff")]
|
||||
[InlineData("('''stuff')", "'stuff")]
|
||||
[InlineData("(N'stu''''ff')", "stu''ff")]
|
||||
public void UnescapeTest(string input, string output)
|
||||
{
|
||||
Assert.Equal(output, SqlScriptFormatter.UnwrapLiteral(input));
|
||||
}
|
||||
|
||||
private class FormatterTestDbColumn : DbColumn
|
||||
{
|
||||
public FormatterTestDbColumn(string dataType, int? precision = null, int? scale = null)
|
||||
|
||||
Reference in New Issue
Block a user