mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
Applying refactor to test project
For some strange reason, the using statements don't seem to want to work for the Message type. The full name has been used instead, but it's an ugly workaround for the time being.
This commit is contained in:
@@ -3,15 +3,15 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
using Microsoft.SqlTools.EditorServices.Protocol.MessageProtocol;
|
|
||||||
using Microsoft.SqlTools.EditorServices.Protocol.MessageProtocol.Serializers;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol.Serializers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
namespace Microsoft.SqlTools.ServiceLayer.Test.Message
|
||||||
{
|
{
|
||||||
public class MessageReaderWriterTests
|
public class MessageReaderWriterTests
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
|||||||
|
|
||||||
// Write the message and then roll back the stream to be read
|
// Write the message and then roll back the stream to be read
|
||||||
// TODO: This will need to be redone!
|
// TODO: This will need to be redone!
|
||||||
await messageWriter.WriteMessage(Message.Event("testEvent", null));
|
await messageWriter.WriteMessage(ServiceLayer.ServiceHost.Protocol.Contracts.Message.Event("testEvent", null));
|
||||||
outputStream.Seek(0, SeekOrigin.Begin);
|
outputStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
string expectedHeaderString =
|
string expectedHeaderString =
|
||||||
@@ -82,7 +82,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
|||||||
inputStream.Flush();
|
inputStream.Flush();
|
||||||
inputStream.Seek(0, SeekOrigin.Begin);
|
inputStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
Message messageResult = messageReader.ReadMessage().Result;
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message messageResult = messageReader.ReadMessage().Result;
|
||||||
Assert.Equal("testEvent", messageResult.Method);
|
Assert.Equal("testEvent", messageResult.Method);
|
||||||
|
|
||||||
inputStream.Dispose();
|
inputStream.Dispose();
|
||||||
@@ -117,7 +117,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
|||||||
// Read the written messages from the stream
|
// Read the written messages from the stream
|
||||||
for (int i = 0; i < overflowMessageCount; i++)
|
for (int i = 0; i < overflowMessageCount; i++)
|
||||||
{
|
{
|
||||||
Message messageResult = messageReader.ReadMessage().Result;
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message messageResult = messageReader.ReadMessage().Result;
|
||||||
Assert.Equal("testEvent", messageResult.Method);
|
Assert.Equal("testEvent", messageResult.Method);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
|||||||
inputStream.Flush();
|
inputStream.Flush();
|
||||||
inputStream.Seek(0, SeekOrigin.Begin);
|
inputStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
Message messageResult = messageReader.ReadMessage().Result;
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message messageResult = messageReader.ReadMessage().Result;
|
||||||
Assert.Equal("testEvent", messageResult.Method);
|
Assert.Equal("testEvent", messageResult.Method);
|
||||||
|
|
||||||
inputStream.Dispose();
|
inputStream.Dispose();
|
||||||
|
|||||||
@@ -3,19 +3,16 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
using Microsoft.SqlTools.EditorServices.Protocol.MessageProtocol;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol
|
namespace Microsoft.SqlTools.ServiceLayer.Test.Message
|
||||||
{
|
{
|
||||||
#region Request Types
|
#region Request Types
|
||||||
|
|
||||||
internal class TestRequest
|
internal class TestRequest
|
||||||
{
|
{
|
||||||
public Task ProcessMessage(
|
public Task ProcessMessage(MessageWriter messageWriter)
|
||||||
EditorSession editorSession,
|
|
||||||
MessageWriter messageWriter)
|
|
||||||
{
|
{
|
||||||
return Task.FromResult(false);
|
return Task.FromResult(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>2d771d16-9d85-4053-9f79-e2034737deef</ProjectGuid>
|
<ProjectGuid>2d771d16-9d85-4053-9f79-e2034737deef</ProjectGuid>
|
||||||
<RootNamespace>Microsoft.SqlTools.EditorServices.Test.Protocol</RootNamespace>
|
<RootNamespace>Microsoft.SqlTools.ServiceLayer.Test</RootNamespace>
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'==''">.\obj</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'==''">.\obj</BaseIntermediateOutputPath>
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
using Microsoft.SqlTools.EditorServices.Protocol.MessageProtocol;
|
using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol.Serializers;
|
||||||
using Microsoft.SqlTools.EditorServices.Protocol.MessageProtocol.Serializers;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer
|
namespace Microsoft.SqlTools.ServiceLayer.Test.ServiceHost
|
||||||
{
|
{
|
||||||
public class TestMessageContents
|
public class TestMessageContents
|
||||||
{
|
{
|
||||||
@@ -44,7 +43,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer
|
|||||||
{
|
{
|
||||||
var messageObj =
|
var messageObj =
|
||||||
this.messageSerializer.SerializeMessage(
|
this.messageSerializer.SerializeMessage(
|
||||||
Message.Request(
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message.Request(
|
||||||
MessageId,
|
MessageId,
|
||||||
MethodName,
|
MethodName,
|
||||||
MessageContent));
|
MessageContent));
|
||||||
@@ -61,7 +60,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer
|
|||||||
{
|
{
|
||||||
var messageObj =
|
var messageObj =
|
||||||
this.messageSerializer.SerializeMessage(
|
this.messageSerializer.SerializeMessage(
|
||||||
Message.Event(
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message.Event(
|
||||||
MethodName,
|
MethodName,
|
||||||
MessageContent));
|
MessageContent));
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer
|
|||||||
{
|
{
|
||||||
var messageObj =
|
var messageObj =
|
||||||
this.messageSerializer.SerializeMessage(
|
this.messageSerializer.SerializeMessage(
|
||||||
Message.Response(
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message.Response(
|
||||||
MessageId,
|
MessageId,
|
||||||
null,
|
null,
|
||||||
MessageContent));
|
MessageContent));
|
||||||
@@ -92,7 +91,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer
|
|||||||
{
|
{
|
||||||
var messageObj =
|
var messageObj =
|
||||||
this.messageSerializer.SerializeMessage(
|
this.messageSerializer.SerializeMessage(
|
||||||
Message.ResponseError(
|
ServiceLayer.ServiceHost.Protocol.Contracts.Message.ResponseError(
|
||||||
MessageId,
|
MessageId,
|
||||||
null,
|
null,
|
||||||
MessageContent));
|
MessageContent));
|
||||||
Reference in New Issue
Block a user