Skip to content

Commit b68b4c9

Browse files
committed
Added documentation summary on the mocked application builder
1 parent f8486c4 commit b68b4c9

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

src/MyTested.Mvc/Internal/Application/MockedApplicationBuilder.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,40 @@
1010
using Microsoft.AspNetCore.Http.Features;
1111
using Microsoft.AspNetCore.Routing;
1212

13+
/// <summary>
14+
/// Mocked <see cref="IApplicationBuilder"/>. Used for extracting registered routes.
15+
/// </summary>
1316
public class MockedApplicationBuilder : IApplicationBuilder
1417
{
1518
private const string ServerFeaturesPropertyName = "server.Features";
1619
private const string ApplicationServicesPropertyName = "application.Services";
1720

1821
private readonly IList<Func<RequestDelegate, RequestDelegate>> components = new List<Func<RequestDelegate, RequestDelegate>>();
1922

23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="MockedApplicationBuilder"/> class.
25+
/// </summary>
26+
/// <param name="serviceProvider">Application service provider.</param>
2027
public MockedApplicationBuilder(IServiceProvider serviceProvider)
2128
{
2229
this.Properties = new Dictionary<string, object>();
2330
this.Routes = new RouteCollection();
2431
this.ApplicationServices = serviceProvider;
2532
}
2633

34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="MockedApplicationBuilder"/> class.
36+
/// </summary>
37+
/// <param name="builder">Application builder to copy properties from.</param>
2738
public MockedApplicationBuilder(IApplicationBuilder builder)
2839
{
2940
this.Properties = builder.Properties;
3041
}
31-
42+
43+
/// <summary>
44+
/// Gets or sets the current application services.
45+
/// </summary>
46+
/// <value>Result of <see cref="IServiceProvider"/> type.</value>
3247
public IServiceProvider ApplicationServices
3348
{
3449
get
@@ -42,6 +57,10 @@ public IServiceProvider ApplicationServices
4257
}
4358
}
4459

60+
/// <summary>
61+
/// Gets the current server feature collection. Not used in the actual testing.
62+
/// </summary>
63+
/// <value>Result of <see cref="IFeatureCollection"/> type.</value>
4564
public IFeatureCollection ServerFeatures
4665
{
4766
get
@@ -50,10 +69,23 @@ public IFeatureCollection ServerFeatures
5069
}
5170
}
5271

72+
/// <summary>
73+
/// Gets the current application properties. Not used in the actual testing.
74+
/// </summary>
75+
/// <value>Result of <see cref="IFeatureCollection"/> type.</value>
5376
public IDictionary<string, object> Properties { get; }
5477

78+
/// <summary>
79+
/// Gets the registered route collection.
80+
/// </summary>
81+
/// <value>Result of <see cref="RouteCollection"/> type.</value>
5582
public RouteCollection Routes { get; set; }
5683

84+
/// <summary>
85+
/// Extracts registered routes from the provided middleware, if such are found.
86+
/// </summary>
87+
/// <param name="middleware">Middleware delegate.</param>
88+
/// <returns>The same <see cref="IApplicationBuilder"/>.</returns>
5789
public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware)
5890
{
5991
this.ExtractRoutes(middleware);
@@ -62,11 +94,19 @@ public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware
6294
return this;
6395
}
6496

97+
/// <summary>
98+
/// Returns new instance of <see cref="IApplicationBuilder"/>. Not used in the actual testing.
99+
/// </summary>
100+
/// <returns>Result of <see cref="IApplicationBuilder"/> type.</returns>
65101
public IApplicationBuilder New()
66102
{
67103
return new MockedApplicationBuilder(this);
68104
}
69105

106+
/// <summary>
107+
/// Builds the application delegate, which will process the incoming HTTP requests. Not used in the actual testing.
108+
/// </summary>
109+
/// <returns>Result of <see cref="RequestDelegate"/> type.</returns>
70110
public RequestDelegate Build()
71111
{
72112
RequestDelegate app = context =>

src/MyTested.Mvc/Internal/Application/TestApplication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
using Microsoft.Extensions.PlatformAbstractions;
3232
using Routes;
3333
using Utilities.Extensions;
34-
34+
3535
public static class TestApplication
3636
{
3737
private static readonly RequestDelegate NullHandler = (c) => TaskCache.CompletedTask;

0 commit comments

Comments
 (0)