Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket platform tests #647

Merged
merged 7 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26223.1
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED0C35EB-7F31-4841-A24F-8EB708FFA959}"
EndProject
Expand Down Expand Up @@ -143,6 +143,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUPerfTestProject", "test\T
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "package", "src\package\package\package.csproj", "{E141A226-CC0A-4F26-BD17-4AE427D81C3B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{376C19DE-31E2-4FF6-88FC-0D0D6233C999}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.CommunicationUtilities.PlatformTests", "test\Microsoft.TestPlatform.CommunicationUtilities.PlatformTests\Microsoft.TestPlatform.CommunicationUtilities.PlatformTests.csproj", "{3E698655-0701-482E-9AA7-F956F6337FC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -741,6 +745,18 @@ Global
{E141A226-CC0A-4F26-BD17-4AE427D81C3B}.Release|x64.Build.0 = Release|Any CPU
{E141A226-CC0A-4F26-BD17-4AE427D81C3B}.Release|x86.ActiveCfg = Release|Any CPU
{E141A226-CC0A-4F26-BD17-4AE427D81C3B}.Release|x86.Build.0 = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|x64.ActiveCfg = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|x64.Build.0 = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Debug|x86.Build.0 = Debug|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|Any CPU.Build.0 = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|x64.ActiveCfg = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|x64.Build.0 = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|x86.ActiveCfg = Release|Any CPU
{3E698655-0701-482E-9AA7-F956F6337FC7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -782,7 +798,7 @@ Global
{DD9382B5-5EC4-4B3D-BEB7-95423731AE29} = {46250E12-4CF1-4051-B4A7-80C8C06E0068}
{156F8811-28BB-4EC7-87D9-434F10FB7DBE} = {46250E12-4CF1-4051-B4A7-80C8C06E0068}
{A5B167ED-873A-4762-9326-5F43B8D3AFF6} = {595BE9C1-E10F-4E50-938A-E6C248D3F950}
{107F28E1-6E91-4A06-8943-E5E5A7E4CA66} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{107F28E1-6E91-4A06-8943-E5E5A7E4CA66} = {376C19DE-31E2-4FF6-88FC-0D0D6233C999}
{D27E1CB4-C641-4C6C-A140-EF5F6215AE29} = {ED0C35EB-7F31-4841-A24F-8EB708FFA959}
{8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{22C2F754-11A1-435A-9F64-645CD4C1C31A} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A}
Expand All @@ -803,5 +819,7 @@ Global
{DED1590A-ED25-413B-8590-006A4DD5B2FD} = {EE49F5DC-5835-4AE3-B3BA-8BDE0AD56330}
{40A8D686-5DD4-4591-9194-DA236577AB0C} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A}
{E141A226-CC0A-4F26-BD17-4AE427D81C3B} = {D27E1CB4-C641-4C6C-A140-EF5F6215AE29}
{376C19DE-31E2-4FF6-88FC-0D0D6233C999} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{3E698655-0701-482E-9AA7-F956F6337FC7} = {376C19DE-31E2-4FF6-88FC-0D0D6233C999}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ public interface ICommunicationManager
/// <param name="rawMessage">serialized message</param>
void SendRawMessage(string rawMessage);

/// <summary>
/// The send hand shake message.
/// </summary>
void SendHandShakeMessage();

/// <summary>
/// Deserializes the Message into actual TestPlatform objects
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;

/// <summary>
Expand Down Expand Up @@ -202,16 +201,6 @@ public void SendMessage(string messageType)
this.WriteAndFlushToChannel(serializedObject);
}

/// <summary>
/// Reads message from the binary reader
/// </summary>
/// <returns>Returns message read from the binary reader</returns>
public Message ReceiveMessage()
{
var rawMessage = this.ReceiveRawMessage();
return this.dataSerializer.DeserializeMessage(rawMessage);
}

/// <summary>
/// Writes message to the binary writer with payload
/// </summary>
Expand All @@ -223,23 +212,6 @@ public void SendMessage(string messageType, object payload)
this.WriteAndFlushToChannel(rawMessage);
}

/// <summary>
/// The send hand shake message.
/// </summary>
public void SendHandShakeMessage()
{
this.SendMessage(MessageType.SessionStart);
}

/// <summary>
/// Reads message from the binary reader
/// </summary>
/// <returns> Raw message string </returns>
public string ReceiveRawMessage()
{
return this.binaryReader.ReadString();
}

/// <summary>
/// Send serialized raw message
/// </summary>
Expand All @@ -250,14 +222,13 @@ public void SendRawMessage(string rawMessage)
}

/// <summary>
/// Deserializes the Message into actual TestPlatform objects
/// Reads message from the binary reader
/// </summary>
/// <typeparam name="T"> The type of object to deserialize to. </typeparam>
/// <param name="message"> Message object </param>
/// <returns> TestPlatform object </returns>
public T DeserializePayload<T>(Message message)
/// <returns>Returns message read from the binary reader</returns>
public Message ReceiveMessage()
{
return this.dataSerializer.DeserializePayload<T>(message);
var rawMessage = this.ReceiveRawMessage();
return this.dataSerializer.DeserializeMessage(rawMessage);
}

/// <summary>
Expand All @@ -280,6 +251,15 @@ public async Task<Message> ReceiveMessageAsync(CancellationToken cancellationTok
return null;
}

/// <summary>
/// Reads message from the binary reader
/// </summary>
/// <returns> Raw message string </returns>
public string ReceiveRawMessage()
{
return this.binaryReader.ReadString();
}

/// <summary>
/// Reads message from the binary reader using read timeout
/// </summary>
Expand All @@ -295,6 +275,17 @@ public async Task<string> ReceiveRawMessageAsync(CancellationToken cancellationT
return str;
}

/// <summary>
/// Deserializes the Message into actual TestPlatform objects
/// </summary>
/// <typeparam name="T"> The type of object to deserialize to. </typeparam>
/// <param name="message"> Message object </param>
/// <returns> TestPlatform object </returns>
public T DeserializePayload<T>(Message message)
{
return this.dataSerializer.DeserializePayload<T>(message);
}

private string TryReceiveRawMessage(CancellationToken cancellationToken)
{
string str = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TestProject>true</TestProject>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<OutputType Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">Exe</OutputType>
<TargetFrameworks>netcoreapp1.0;net46</TargetFrameworks>
<AssemblyName>Microsoft.TestPlatform.CommunicationUtilities.PlatformTests</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.CommunicationUtilities\Microsoft.TestPlatform.CommunicationUtilities.csproj" />
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.CoreUtilities\Microsoft.TestPlatform.CoreUtilities.csproj">
<FromP2P>true</FromP2P>
</ProjectReference>
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.ObjectModel\Microsoft.TestPlatform.ObjectModel.csproj">
<FromP2P>true</FromP2P>
</ProjectReference>
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.Common\Microsoft.TestPlatform.Common.csproj">
<FromP2P>true</FromP2P>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(TestPlatformRoot)scripts\build\TestPlatform.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.

namespace Microsoft.TestPlatform.CommunicationUtilities.PlatformTests
{
public static class Program
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for every test project that targets netcoreapp. We don't include NET.Test.Sdk directly.

{
public static void Main(string[] args)
{
}
}
}
Loading