fixed the bug with editing more than one row should fail (#613)

* fixed the bug with editing more than one row should fail
This commit is contained in:
Leila Lali
2018-05-02 13:51:07 -07:00
committed by GitHub
parent c8263d8330
commit 5baa3bc18a
2 changed files with 22 additions and 5 deletions

View File

@@ -271,7 +271,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
// ... Validate the command's makeup
// Break the query into parts
string[] splitSql = cmd.CommandText.Split(Environment.NewLine);
Assert.Equal(3, splitSql.Length);
Assert.True(splitSql.Length >= 3);
// Check the declare statement first
Regex declareRegex = new Regex(@"^DECLARE @(.+) TABLE \((.+)\)$");
@@ -291,7 +291,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
? @"^UPDATE (.+) WITH \(SNAPSHOT\) SET (.+) OUTPUT (.+) INTO @(.+) WHERE .+$"
: @"^UPDATE (.+) SET (.+) OUTPUT (.+) INTO @(.+) WHERE .+$";
Regex updateRegex = new Regex(regex);
Match updateMatch = updateRegex.Match(splitSql[1]);
Match updateMatch = updateRegex.Match(splitSql[10]);
Assert.True(updateMatch.Success);
// Table name matches
@@ -313,7 +313,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
// Check the select statement last
Regex selectRegex = new Regex(@"^SELECT (.+) FROM @(.+)$");
Match selectMatch = selectRegex.Match(splitSql[2]);
Match selectMatch = selectRegex.Match(splitSql[11]);
Assert.True(selectMatch.Success);
// Correct number of columns in select statement