clean-up and renaming

renamed WebSockets project to clarify it's internalityness
This commit is contained in:
Andrew Stanton-Nurse 2016-10-17 15:27:23 -07:00
parent d2dbd473a0
commit affcb935d7
23 changed files with 32 additions and 43 deletions

View File

@ -23,9 +23,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6A35B453-5
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Sockets.Tests", "test\Microsoft.AspNetCore.Sockets.Tests\Microsoft.AspNetCore.Sockets.Tests.xproj", "{AAD719D5-5E31-4ED1-A60F-6EB92EFA66D9}" Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Sockets.Tests", "test\Microsoft.AspNetCore.Sockets.Tests\Microsoft.AspNetCore.Sockets.Tests.xproj", "{AAD719D5-5E31-4ED1-A60F-6EB92EFA66D9}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSockets", "src\Microsoft.Extensions.WebSockets\Microsoft.Extensions.WebSockets.xproj", "{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}" Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSockets.Internal", "src\Microsoft.Extensions.WebSockets.Internal\Microsoft.Extensions.WebSockets.Internal.xproj", "{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSockets.Tests", "test\Microsoft.Extensions.WebSockets.Tests\Microsoft.Extensions.WebSockets.Tests.xproj", "{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2}" Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSockets.Internal.Tests", "test\Microsoft.Extensions.WebSockets.Internal.Tests\Microsoft.Extensions.WebSockets.Internal.Tests.xproj", "{A7050BAE-3DB9-4FB3-A49D-303201415B13}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -53,10 +53,10 @@ Global
{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Debug|Any CPU.Build.0 = Debug|Any CPU {5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Release|Any CPU.ActiveCfg = Release|Any CPU {5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Release|Any CPU.Build.0 = Release|Any CPU {5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775}.Release|Any CPU.Build.0 = Release|Any CPU
{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7050BAE-3DB9-4FB3-A49D-303201415B13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {A7050BAE-3DB9-4FB3-A49D-303201415B13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {A7050BAE-3DB9-4FB3-A49D-303201415B13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2}.Release|Any CPU.Build.0 = Release|Any CPU {A7050BAE-3DB9-4FB3-A49D-303201415B13}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -67,6 +67,6 @@ Global
{BA99C2A1-48F9-4FA5-B95A-9687A73B7CC9} = {C4BC9889-B49F-41B6-806B-F84941B2549B} {BA99C2A1-48F9-4FA5-B95A-9687A73B7CC9} = {C4BC9889-B49F-41B6-806B-F84941B2549B}
{AAD719D5-5E31-4ED1-A60F-6EB92EFA66D9} = {6A35B453-52EC-48AF-89CA-D4A69800F131} {AAD719D5-5E31-4ED1-A60F-6EB92EFA66D9} = {6A35B453-52EC-48AF-89CA-D4A69800F131}
{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775} = {DA69F624-5398-4884-87E4-B816698CDE65} {5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775} = {DA69F624-5398-4884-87E4-B816698CDE65}
{8FA6BE8F-B5EB-42F9-9B16-101917CC45E2} = {6A35B453-52EC-48AF-89CA-D4A69800F131} {A7050BAE-3DB9-4FB3-A49D-303201415B13} = {6A35B453-52EC-48AF-89CA-D4A69800F131}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,6 +1,4 @@
using System; using System.Threading;
using System.Buffers;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels; using Channels;

View File

@ -2,7 +2,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Represents a connection to a WebSocket endpoint. /// Represents a connection to a WebSocket endpoint.
@ -75,7 +75,8 @@ namespace Microsoft.Extensions.WebSockets
/// <param name="messageHandler">The callback that will be invoked for each new frame</param> /// <param name="messageHandler">The callback that will be invoked for each new frame</param>
/// <returns>A <see cref="Task{WebSocketCloseResult}"/> that will complete when the client has sent a close frame, or the connection has been terminated</returns> /// <returns>A <see cref="Task{WebSocketCloseResult}"/> that will complete when the client has sent a close frame, or the connection has been terminated</returns>
public static Task<WebSocketCloseResult> ExecuteAsync(this IWebSocketConnection self, Action<WebSocketFrame> messageHandler) => public static Task<WebSocketCloseResult> ExecuteAsync(this IWebSocketConnection self, Action<WebSocketFrame> messageHandler) =>
self.ExecuteAsync((frame, _) => { self.ExecuteAsync((frame, _) =>
{
messageHandler(frame); messageHandler(frame);
return Task.CompletedTask; return Task.CompletedTask;
}, null); }, null);
@ -86,7 +87,8 @@ namespace Microsoft.Extensions.WebSockets
/// <param name="messageHandler">The callback that will be invoked for each new frame</param> /// <param name="messageHandler">The callback that will be invoked for each new frame</param>
/// <returns>A <see cref="Task{WebSocketCloseResult}"/> that will complete when the client has sent a close frame, or the connection has been terminated</returns> /// <returns>A <see cref="Task{WebSocketCloseResult}"/> that will complete when the client has sent a close frame, or the connection has been terminated</returns>
public static Task<WebSocketCloseResult> ExecuteAsync(this IWebSocketConnection self, Action<WebSocketFrame, object> messageHandler, object state) => public static Task<WebSocketCloseResult> ExecuteAsync(this IWebSocketConnection self, Action<WebSocketFrame, object> messageHandler, object state) =>
self.ExecuteAsync((frame, s) => { self.ExecuteAsync((frame, s) =>
{
messageHandler(frame, s); messageHandler(frame, s);
return Task.CompletedTask; return Task.CompletedTask;
}, state); }, state);

View File

@ -2,7 +2,7 @@
using System.Binary; using System.Binary;
using Channels; using Channels;
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
internal static class MaskingUtilities internal static class MaskingUtilities
{ {

View File

@ -3,7 +3,7 @@ using System.Text;
using Channels; using Channels;
using Channels.Text.Primitives; using Channels.Text.Primitives;
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Represents the payload of a Close frame (i.e. a <see cref="WebSocketFrame"/> with an <see cref="WebSocketFrame.Opcode"/> of <see cref="WebSocketOpcode.Close"/>). /// Represents the payload of a Close frame (i.e. a <see cref="WebSocketFrame"/> with an <see cref="WebSocketFrame.Opcode"/> of <see cref="WebSocketOpcode.Close"/>).

View File

@ -1,4 +1,4 @@
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Represents well-known WebSocket Close frame status codes. /// Represents well-known WebSocket Close frame status codes.

View File

@ -5,9 +5,8 @@ using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels; using Channels;
using Microsoft.Extensions.WebSockets.Internal;
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Provides the default implementation of <see cref="IWebSocketConnection"/>. /// Provides the default implementation of <see cref="IWebSocketConnection"/>.

View File

@ -1,9 +1,4 @@
using System; namespace Microsoft.Extensions.WebSockets.Internal
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.Extensions.WebSockets
{ {
public enum WebSocketConnectionState public enum WebSocketConnectionState
{ {

View File

@ -1,8 +1,6 @@
using System; using Channels;
using System.Text;
using Channels;
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Represents a single Frame received or sent on a <see cref="IWebSocketConnection"/>. /// Represents a single Frame received or sent on a <see cref="IWebSocketConnection"/>.

View File

@ -1,4 +1,4 @@
namespace Microsoft.Extensions.WebSockets namespace Microsoft.Extensions.WebSockets.Internal
{ {
/// <summary> /// <summary>
/// Represents the possible values for the "opcode" field of a WebSocket frame. /// Represents the possible values for the "opcode" field of a WebSocket frame.

View File

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<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>8fa6be8f-b5eb-42f9-9b16-101917cc45e2</ProjectGuid> <ProjectGuid>a7050bae-3db9-4fb3-a49d-303201415b13</ProjectGuid>
<RootNamespace>Microsoft.Extensions.WebSockets.Tests</RootNamespace> <RootNamespace>Microsoft.Extensions.WebSockets.Internal.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup> </PropertyGroup>

View File

@ -2,7 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels; using Channels;
namespace Microsoft.Extensions.WebSockets.Tests namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
public static class WebSocketConnectionExtensions public static class WebSocketConnectionExtensions
{ {

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Microsoft.Extensions.WebSockets.Tests namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
public class WebSocketConnectionSummary public class WebSocketConnectionSummary
{ {

View File

@ -3,11 +3,9 @@ using System.Diagnostics;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels;
using Microsoft.Extensions.WebSockets.Test;
using Xunit; using Xunit;
namespace Microsoft.Extensions.WebSockets.Tests namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
public partial class WebSocketConnectionTests public partial class WebSocketConnectionTests
{ {
@ -50,7 +48,7 @@ namespace Microsoft.Extensions.WebSockets.Tests
[Fact] [Fact]
public async Task ExecuteReturnsWhenCloseFrameReceived() public async Task ExecuteReturnsWhenCloseFrameReceived()
{ {
using(var pair = WebSocketPair.Create()) using (var pair = WebSocketPair.Create())
{ {
var client = pair.ClientSocket.ExecuteAndCaptureFramesAsync(); var client = pair.ClientSocket.ExecuteAndCaptureFramesAsync();
await pair.ClientSocket.CloseAsync(new WebSocketCloseResult(WebSocketCloseStatus.InvalidMessageType, "Abc")); await pair.ClientSocket.CloseAsync(new WebSocketCloseResult(WebSocketCloseStatus.InvalidMessageType, "Abc"));
@ -71,7 +69,7 @@ namespace Microsoft.Extensions.WebSockets.Tests
[Fact] [Fact]
public async Task AbnormalTerminationOfInboundChannelCausesExecuteToThrow() public async Task AbnormalTerminationOfInboundChannelCausesExecuteToThrow()
{ {
using(var pair = WebSocketPair.Create()) using (var pair = WebSocketPair.Create())
{ {
var client = pair.ClientSocket.ExecuteAndCaptureFramesAsync(); var client = pair.ClientSocket.ExecuteAndCaptureFramesAsync();
var server = pair.ServerSocket.ExecuteAndCaptureFramesAsync(); var server = pair.ServerSocket.ExecuteAndCaptureFramesAsync();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -7,7 +6,7 @@ using System.Threading.Tasks;
using Channels; using Channels;
using Xunit; using Xunit;
namespace Microsoft.Extensions.WebSockets.Tests namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
public partial class WebSocketConnectionTests public partial class WebSocketConnectionTests
{ {

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Channels; using Channels;
using Xunit; using Xunit;
namespace Microsoft.Extensions.WebSockets.Tests namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
public partial class WebSocketConnectionTests public partial class WebSocketConnectionTests
{ {

View File

@ -1,7 +1,7 @@
using System; using System;
using Channels; using Channels;
namespace Microsoft.Extensions.WebSockets.Test namespace Microsoft.Extensions.WebSockets.Internal.Tests
{ {
internal class WebSocketPair : IDisposable internal class WebSocketPair : IDisposable
{ {

View File

@ -4,7 +4,7 @@
}, },
"dependencies": { "dependencies": {
"dotnet-test-xunit": "1.0.0-rc3-000000-01", "dotnet-test-xunit": "1.0.0-rc3-000000-01",
"Microsoft.Extensions.WebSockets": "0.1.0-*", "Microsoft.Extensions.WebSockets.Internal": "0.1.0-*",
"xunit": "2.1.0" "xunit": "2.1.0"
}, },
"testRunner": "xunit", "testRunner": "xunit",