include additional data for error object (#1539)

* include additional data for error

* fix tests
This commit is contained in:
Alan Ren
2022-06-10 20:40:22 -07:00
committed by GitHub
parent 5e3d24bbfa
commit 17b6073c87
14 changed files with 64 additions and 54 deletions

View File

@@ -21,7 +21,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
{
public class TSqlFormatterServiceTests : FormatterUnitTestsBase
{
private Mock<ServiceLayer.Workspace.Workspace> workspaceMock;
private Mock<ServiceLayer.Workspace.Workspace> workspaceMock;
private TextDocumentIdentifier textDocument;
DocumentFormattingParams docFormatParams;
DocumentRangeFormattingParams rangeFormatParams;
@@ -60,7 +60,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
C1 int NOT NULL,
C2 nvarchar(50) NULL
)");
private void SetupLanguageService(bool skipFile = false)
{
LanguageServiceMock.Setup(x => x.ShouldSkipNonMssqlFile(It.IsAny<string>())).Returns(skipFile);
@@ -216,11 +216,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
await test(contextMock.Object);
VerifyResult(contextMock, verify);
}
public static void VerifyResult<T>(Mock<RequestContext<T>> contextMock, Action verify)
{
contextMock.Verify(c => c.SendResult(It.IsAny<T>()), Times.Once);
contextMock.Verify(c => c.SendError(It.IsAny<string>(), It.IsAny<int>()), Times.Never);
contextMock.Verify(c => c.SendError(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()), Times.Never);
verify();
}
@@ -253,7 +253,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
};
return scriptFile;
}
}
}