Browse Source

Add API docs for AzureAppServices and SignalR.Specification (#28963)

Brennan 5 years ago
parent
commit
de21923744

+ 3 - 0
src/Azure/AzureAppServicesIntegration/src/AppServicesWebHostBuilderExtensions.cs

@@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging;
 
 namespace Microsoft.AspNetCore.Hosting
 {
+    /// <summary>
+    /// Extension method to add Azure AppServices integration to the app.
+    /// </summary>
     public static class AppServicesWebHostBuilderExtensions
     {
         /// <summary>

+ 1 - 2
src/Azure/AzureAppServicesIntegration/src/Microsoft.AspNetCore.AzureAppServicesIntegration.csproj

@@ -1,9 +1,8 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <Description>ASP.NET Core integration with Azure AppServices.</Description>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
-    <NoWarn>$(NoWarn);CS1591</NoWarn>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
     <PackageTags>aspnetcore;azure;appservices</PackageTags>

+ 3 - 3
src/SignalR/server/SignalR/test/DefaultHubLifetimeManagerTests.cs

@@ -12,11 +12,11 @@ using Xunit;
 
 namespace Microsoft.AspNetCore.SignalR.Tests
 {
-    public class DefaultHubLifetimeManagerTests : HubLifetimeManagerTestsBase<MyHub>
+    public class DefaultHubLifetimeManagerTests : HubLifetimeManagerTestsBase<Hub>
     {
-        public override HubLifetimeManager<MyHub> CreateNewHubLifetimeManager()
+        public override HubLifetimeManager<Hub> CreateNewHubLifetimeManager()
         {
-            return new DefaultHubLifetimeManager<MyHub>(new Logger<DefaultHubLifetimeManager<MyHub>>(NullLoggerFactory.Instance));
+            return new DefaultHubLifetimeManager<Hub>(new Logger<DefaultHubLifetimeManager<Hub>>(NullLoggerFactory.Instance));
         }
 
         [Fact]

+ 34 - 1
src/SignalR/server/Specification.Tests/src/HubLifetimeManagerTestBase.cs

@@ -1,6 +1,7 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
+using System;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.SignalR.Protocol;
 using Microsoft.AspNetCore.SignalR.Tests;
@@ -8,12 +9,28 @@ using Xunit;
 
 namespace Microsoft.AspNetCore.SignalR.Specification.Tests
 {
+    /// <summary>
+    /// Base test class for lifetime manager implementations. Nothing specific to scale-out for these tests.
+    /// </summary>
+    /// <typeparam name="THub">The type of the <see cref="Hub"/>.</typeparam>
     public abstract class HubLifetimeManagerTestsBase<THub> where THub : Hub
     {
+        /// <summary>
+        /// This API is obsolete and will be removed in a future version. Use CreateNewHubLifetimeManager in tests instead.
+        /// </summary>
+        [Obsolete("This API is obsolete and will be removed in a future version. Use CreateNewHubLifetimeManager in tests instead.")]
         public HubLifetimeManager<THub> Manager { get; set; }
 
+        /// <summary>
+        /// Method to create an implementation of <see cref="HubLifetimeManager{THub}"/> for use in tests.
+        /// </summary>
+        /// <returns>The implementation of <see cref="HubLifetimeManager{THub}"/> to test against.</returns>
         public abstract HubLifetimeManager<THub> CreateNewHubLifetimeManager();
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task SendAllAsyncWritesToAllConnectionsOutput()
         {
@@ -41,6 +58,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task SendAllAsyncDoesNotWriteToDisconnectedConnectionsOutput()
         {
@@ -67,6 +88,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task SendGroupAsyncWritesToAllConnectionsInGroupOutput()
         {
@@ -93,6 +118,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task SendGroupExceptAsyncDoesNotWriteToExcludedConnections()
         {
@@ -120,6 +149,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task SendConnectionAsyncWritesToConnectionOutput()
         {

+ 1 - 2
src/SignalR/server/Specification.Tests/src/Microsoft.AspNetCore.SignalR.Specification.Tests.csproj

@@ -1,10 +1,9 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <Description>Tests for users to verify their own implementations of SignalR types</Description>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <IsPackable>true</IsPackable>
-    <NoWarn>$(NoWarn);CS1591</NoWarn>
   </PropertyGroup>
 
   <ItemGroup>

+ 81 - 9
src/SignalR/server/Specification.Tests/src/ScaleoutHubLifetimeManagerTests.cs

@@ -1,8 +1,6 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
-using System;
-using System.Threading;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.SignalR.Protocol;
 using Microsoft.AspNetCore.SignalR.Tests;
@@ -10,10 +8,24 @@ using Xunit;
 
 namespace Microsoft.AspNetCore.SignalR.Specification.Tests
 {
-    public abstract class ScaleoutHubLifetimeManagerTests<TBackplane> : HubLifetimeManagerTestsBase<MyHub>
+    /// <summary>
+    /// Base test class for lifetime manager implementations that support server scale-out.
+    /// </summary>
+    /// <typeparam name="TBackplane">An in-memory implementation of the backplane that <see cref="HubLifetimeManager{THub}"/>s communicate with.</typeparam>
+    public abstract class ScaleoutHubLifetimeManagerTests<TBackplane> : HubLifetimeManagerTestsBase<Hub>
     {
+        /// <summary>
+        /// Method to create an implementation of an in-memory backplane for use in tests.
+        /// </summary>
+        /// <returns>The backplane implementation.</returns>
         public abstract TBackplane CreateBackplane();
-        public abstract HubLifetimeManager<MyHub> CreateNewHubLifetimeManager(TBackplane backplane);
+
+        /// <summary>
+        /// Method to create an implementation of <see cref="HubLifetimeManager{THub}"/> that uses the backplane from <see cref="CreateBackplane"/>.
+        /// </summary>
+        /// <param name="backplane">The backplane implementation for use in the <see cref="HubLifetimeManager{THub}"/>.</param>
+        /// <returns></returns>
+        public abstract HubLifetimeManager<Hub> CreateNewHubLifetimeManager(TBackplane backplane);
 
         private async Task AssertMessageAsync(TestClient client)
         {
@@ -23,9 +35,12 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             Assert.Equal("World", (string)message.Arguments[0]);
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeAllAsyncWithMultipleServersWritesToAllConnectionsOutput()
-
         {
             var backplane = CreateBackplane();
             var manager1 = CreateNewHubLifetimeManager(backplane);
@@ -47,6 +62,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeAllAsyncWithMultipleServersDoesNotWriteToDisconnectedConnectionsOutput()
         {
@@ -73,6 +92,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeConnectionAsyncOnServerWithoutConnectionWritesOutputToConnection()
         {
@@ -93,6 +116,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeGroupAsyncOnServerWithoutConnectionWritesOutputToGroupConnection()
         {
@@ -115,6 +142,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task DisconnectConnectionRemovesConnectionFromGroup()
         {
@@ -137,6 +168,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task RemoveGroupFromLocalConnectionNotInGroupDoesNothing()
         {
@@ -153,6 +188,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task RemoveGroupFromConnectionOnDifferentServerNotInGroupDoesNothing()
         {
@@ -170,6 +209,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task AddGroupAsyncForConnectionOnDifferentServerWorks()
         {
@@ -191,6 +234,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task AddGroupAsyncForLocalConnectionAlreadyInGroupDoesNothing()
         {
@@ -213,6 +260,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task AddGroupAsyncForConnectionOnDifferentServerAlreadyInGroupDoesNothing()
         {
@@ -236,6 +287,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task RemoveGroupAsyncForConnectionOnDifferentServerWorks()
         {
@@ -263,6 +318,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeConnectionAsyncForLocalConnectionDoesNotPublishToBackplane()
         {
@@ -285,6 +344,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task WritingToRemoteConnectionThatFailsDoesNotThrow()
         {
@@ -305,6 +368,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task WritingToGroupWithOneConnectionFailingSecondConnectionStillReceivesMessage()
         {
@@ -336,6 +403,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task InvokeUserSendsToAllConnectionsForUser()
         {
@@ -360,6 +431,10 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
 
+        /// <summary>
+        /// Specification test for SignalR HubLifetimeManager.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous completion of the test.</returns>
         [Fact]
         public async Task StillSubscribedToUserAfterOneOfMultipleConnectionsAssociatedWithUserDisconnects()
         {
@@ -389,7 +464,4 @@ namespace Microsoft.AspNetCore.SignalR.Specification.Tests
             }
         }
     }
-    public class MyHub : Hub
-    {
-    }
 }

+ 3 - 3
src/SignalR/server/StackExchangeRedis/test/RedisHubLifetimeManagerTests.cs

@@ -22,13 +22,13 @@ namespace Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests
             public string TestProperty { get; set; }
         }
 
-        private RedisHubLifetimeManager<MyHub> CreateLifetimeManager(TestRedisServer server, MessagePackHubProtocolOptions messagePackOptions = null, NewtonsoftJsonHubProtocolOptions jsonOptions = null)
+        private RedisHubLifetimeManager<Hub> CreateLifetimeManager(TestRedisServer server, MessagePackHubProtocolOptions messagePackOptions = null, NewtonsoftJsonHubProtocolOptions jsonOptions = null)
         {
             var options = new RedisOptions() { ConnectionFactory = async (t) => await Task.FromResult(new TestConnectionMultiplexer(server)) };
             messagePackOptions = messagePackOptions ?? new MessagePackHubProtocolOptions();
             jsonOptions = jsonOptions ?? new NewtonsoftJsonHubProtocolOptions();
-            return new RedisHubLifetimeManager<MyHub>(
-                NullLogger<RedisHubLifetimeManager<MyHub>>.Instance,
+            return new RedisHubLifetimeManager<Hub>(
+                NullLogger<RedisHubLifetimeManager<Hub>>.Instance,
                 Options.Create(options),
                 new DefaultHubProtocolResolver(new IHubProtocol[]
                 {