From bd83045a0aec80b64d7cde0cc40e53432d4b44a8 Mon Sep 17 00:00:00 2001 From: Benjamin Russell Date: Fri, 22 Jul 2016 16:56:34 -0700 Subject: [PATCH] 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. --- .../Message/MessageReaderWriterTests.cs | 14 +++++++------- test/ServiceHost.Test/Message/TestMessageTypes.cs | 9 +++------ test/ServiceHost.Test/ServiceHost.Test.xproj | 2 +- .../JsonRpcMessageSerializerTests.cs | 13 ++++++------- 4 files changed, 17 insertions(+), 21 deletions(-) rename test/ServiceHost.Test/{LanguageServer => ServiceHost}/JsonRpcMessageSerializerTests.cs (89%) diff --git a/test/ServiceHost.Test/Message/MessageReaderWriterTests.cs b/test/ServiceHost.Test/Message/MessageReaderWriterTests.cs index 82e619f5..087c63c4 100644 --- a/test/ServiceHost.Test/Message/MessageReaderWriterTests.cs +++ b/test/ServiceHost.Test/Message/MessageReaderWriterTests.cs @@ -3,15 +3,15 @@ // 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.IO; using System.Text; using System.Threading.Tasks; +using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol; +using Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol.Serializers; using Xunit; -namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol +namespace Microsoft.SqlTools.ServiceLayer.Test.Message { 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 // 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); string expectedHeaderString = @@ -82,7 +82,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol inputStream.Flush(); inputStream.Seek(0, SeekOrigin.Begin); - Message messageResult = messageReader.ReadMessage().Result; + ServiceLayer.ServiceHost.Protocol.Contracts.Message messageResult = messageReader.ReadMessage().Result; Assert.Equal("testEvent", messageResult.Method); inputStream.Dispose(); @@ -117,7 +117,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol // Read the written messages from the stream 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); } @@ -145,7 +145,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol inputStream.Flush(); inputStream.Seek(0, SeekOrigin.Begin); - Message messageResult = messageReader.ReadMessage().Result; + ServiceLayer.ServiceHost.Protocol.Contracts.Message messageResult = messageReader.ReadMessage().Result; Assert.Equal("testEvent", messageResult.Method); inputStream.Dispose(); diff --git a/test/ServiceHost.Test/Message/TestMessageTypes.cs b/test/ServiceHost.Test/Message/TestMessageTypes.cs index cc5981dc..f0819449 100644 --- a/test/ServiceHost.Test/Message/TestMessageTypes.cs +++ b/test/ServiceHost.Test/Message/TestMessageTypes.cs @@ -3,19 +3,16 @@ // 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 Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol; -namespace Microsoft.SqlTools.EditorServices.Test.Protocol.MessageProtocol +namespace Microsoft.SqlTools.ServiceLayer.Test.Message { #region Request Types internal class TestRequest { - public Task ProcessMessage( - EditorSession editorSession, - MessageWriter messageWriter) + public Task ProcessMessage(MessageWriter messageWriter) { return Task.FromResult(false); } diff --git a/test/ServiceHost.Test/ServiceHost.Test.xproj b/test/ServiceHost.Test/ServiceHost.Test.xproj index 7e4a3242..5e9d1a09 100644 --- a/test/ServiceHost.Test/ServiceHost.Test.xproj +++ b/test/ServiceHost.Test/ServiceHost.Test.xproj @@ -7,7 +7,7 @@ 2d771d16-9d85-4053-9f79-e2034737deef - Microsoft.SqlTools.EditorServices.Test.Protocol + Microsoft.SqlTools.ServiceLayer.Test .\obj .\bin\ v4.5.2 diff --git a/test/ServiceHost.Test/LanguageServer/JsonRpcMessageSerializerTests.cs b/test/ServiceHost.Test/ServiceHost/JsonRpcMessageSerializerTests.cs similarity index 89% rename from test/ServiceHost.Test/LanguageServer/JsonRpcMessageSerializerTests.cs rename to test/ServiceHost.Test/ServiceHost/JsonRpcMessageSerializerTests.cs index 9ec341c5..9b9c3bf5 100644 --- a/test/ServiceHost.Test/LanguageServer/JsonRpcMessageSerializerTests.cs +++ b/test/ServiceHost.Test/ServiceHost/JsonRpcMessageSerializerTests.cs @@ -3,12 +3,11 @@ // 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 Microsoft.SqlTools.ServiceLayer.ServiceHost.Protocol.Serializers; using Newtonsoft.Json.Linq; using Xunit; -namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer +namespace Microsoft.SqlTools.ServiceLayer.Test.ServiceHost { public class TestMessageContents { @@ -44,7 +43,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer { var messageObj = this.messageSerializer.SerializeMessage( - Message.Request( + ServiceLayer.ServiceHost.Protocol.Contracts.Message.Request( MessageId, MethodName, MessageContent)); @@ -61,7 +60,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer { var messageObj = this.messageSerializer.SerializeMessage( - Message.Event( + ServiceLayer.ServiceHost.Protocol.Contracts.Message.Event( MethodName, MessageContent)); @@ -76,7 +75,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer { var messageObj = this.messageSerializer.SerializeMessage( - Message.Response( + ServiceLayer.ServiceHost.Protocol.Contracts.Message.Response( MessageId, null, MessageContent)); @@ -92,7 +91,7 @@ namespace Microsoft.SqlTools.EditorServices.Test.Protocol.LanguageServer { var messageObj = this.messageSerializer.SerializeMessage( - Message.ResponseError( + ServiceLayer.ServiceHost.Protocol.Contracts.Message.ResponseError( MessageId, null, MessageContent));