From 377ed1b8343f91bc572bf107151b73795d7ed413 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 15 Apr 2018 09:58:05 +1200 Subject: [PATCH] JsonHubProtocol and MessagePackHubProtocol version fields now private (#2023) --- .../Protocol/JsonHubProtocol.cs | 4 ++-- .../Protocol/MessagePackHubProtocol.cs | 4 ++-- .../Microsoft.AspNetCore.SignalR.Redis.Tests/RedisEndToEnd.cs | 4 ++-- .../Internal/DefaultHubProtocolResolverTests.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.AspNetCore.SignalR.Protocols.Json/Protocol/JsonHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Protocols.Json/Protocol/JsonHubProtocol.cs index 039a5ef1d5..5c1c1488e9 100644 --- a/src/Microsoft.AspNetCore.SignalR.Protocols.Json/Protocol/JsonHubProtocol.cs +++ b/src/Microsoft.AspNetCore.SignalR.Protocols.Json/Protocol/JsonHubProtocol.cs @@ -28,8 +28,8 @@ namespace Microsoft.AspNetCore.SignalR.Protocol private const string ArgumentsPropertyName = "arguments"; private const string HeadersPropertyName = "headers"; - public static readonly string ProtocolName = "json"; - public static readonly int ProtocolVersion = 1; + private static readonly string ProtocolName = "json"; + private static readonly int ProtocolVersion = 1; // ONLY to be used for application payloads (args, return values, etc.) public JsonSerializer PayloadSerializer { get; } diff --git a/src/Microsoft.AspNetCore.SignalR.Protocols.MessagePack/Protocol/MessagePackHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Protocols.MessagePack/Protocol/MessagePackHubProtocol.cs index 3684bdf292..dfd1d98c8f 100644 --- a/src/Microsoft.AspNetCore.SignalR.Protocols.MessagePack/Protocol/MessagePackHubProtocol.cs +++ b/src/Microsoft.AspNetCore.SignalR.Protocols.MessagePack/Protocol/MessagePackHubProtocol.cs @@ -25,8 +25,8 @@ namespace Microsoft.AspNetCore.SignalR.Protocol private IFormatterResolver _resolver; - public static readonly string ProtocolName = "messagepack"; - public static readonly int ProtocolVersion = 1; + private static readonly string ProtocolName = "messagepack"; + private static readonly int ProtocolVersion = 1; public string Name => ProtocolName; diff --git a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/RedisEndToEnd.cs b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/RedisEndToEnd.cs index 0c80b616dc..06eaf9a40e 100644 --- a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/RedisEndToEnd.cs +++ b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/RedisEndToEnd.cs @@ -117,11 +117,11 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests { foreach (var transport in TransportTypes()) { - yield return new object[] { transport, JsonHubProtocol.ProtocolName }; + yield return new object[] { transport, "json" }; if (transport != HttpTransportType.ServerSentEvents) { - yield return new object[] { transport, MessagePackHubProtocol.ProtocolName }; + yield return new object[] { transport, "messagepack" }; } } } diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/Internal/DefaultHubProtocolResolverTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/Internal/DefaultHubProtocolResolverTests.cs index e5f7cb5023..cce80cde51 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/Internal/DefaultHubProtocolResolverTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/Internal/DefaultHubProtocolResolverTests.cs @@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.SignalR.Common.Protocol.Tests new JsonHubProtocol() }, NullLogger.Instance)); - Assert.Equal($"Multiple Hub Protocols with the name '{JsonHubProtocol.ProtocolName}' were registered.", exception.Message); + Assert.Equal($"Multiple Hub Protocols with the name 'json' were registered.", exception.Message); } public static IEnumerable HubProtocolNames => HubProtocolHelpers.AllProtocols.Select(p => new object[] {p.Name});