Skip to content

Commit 8ad1c2d

Browse files
committed
Added documentation summary on route test builders
1 parent 0f36946 commit 8ad1c2d

12 files changed

+284
-147
lines changed

src/MyTested.Mvc/Builders/Contracts/Http/IHttpRequestBuilder.cs

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

src/MyTested.Mvc/Builders/Contracts/Http/IHttpResponseTestBuilder.cs

Lines changed: 46 additions & 31 deletions
Large diffs are not rendered by default.

src/MyTested.Mvc/Builders/Contracts/Http/IResponseCookieTestBuilder.cs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,79 @@
22
{
33
using System;
44

5+
/// <summary>
6+
/// Used for testing <see cref="Microsoft.AspNetCore.Http.HttpResponse"/> cookie.
7+
/// </summary>
58
public interface IResponseCookieTestBuilder
69
{
10+
/// <summary>
11+
/// Sets the expected <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Name"/> of the tested cookie.
12+
/// </summary>
13+
/// <param name="name">Name to set on the cookie.</param>
14+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
715
IAndResponseCookieTestBuilder WithName(string name);
816

17+
/// <summary>
18+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Value"/> property is the same as the provided one.
19+
/// </summary>
20+
/// <param name="value">Expected value of the cookie.</param>
21+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
922
IAndResponseCookieTestBuilder WithValue(string value);
1023

24+
/// <summary>
25+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Value"/> passes the provided assertions.
26+
/// </summary>
27+
/// <param name="assertions">Action containing assertions on the cookie value.</param>
28+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
1129
IAndResponseCookieTestBuilder WithValue(Action<string> assertions);
12-
30+
31+
/// <summary>
32+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Value"/> passes the provided predicate.
33+
/// </summary>
34+
/// <param name="predicate">Predicate testing the cookie value.</param>
35+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
1336
IAndResponseCookieTestBuilder WithValue(Func<string, bool> predicate);
1437

38+
/// <summary>
39+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Domain"/> property is the same as provided one.
40+
/// </summary>
41+
/// <param name="domain">Expected domain of the cookie.</param>
42+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
1543
IAndResponseCookieTestBuilder WithDomain(string domain);
1644

45+
/// <summary>
46+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Expires"/> property is the same as provided one.
47+
/// </summary>
48+
/// <param name="expires">Expected expiration date time offset of the cookie.</param>
49+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
1750
IAndResponseCookieTestBuilder WithExpired(DateTimeOffset? expires);
1851

52+
/// <summary>
53+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.HttpOnly"/> property is the same as provided one.
54+
/// </summary>
55+
/// <param name="httpOnly">Expected <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.HttpOnly"/> property of the cookie.</param>
56+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
1957
IAndResponseCookieTestBuilder WithHttpOnly(bool httpOnly);
2058

59+
/// <summary>
60+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.MaxAge"/> property is the same as provided one.
61+
/// </summary>
62+
/// <param name="maxAge">Expected <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.MaxAge"/> property of the cookie.</param>
63+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
2164
IAndResponseCookieTestBuilder WithMaxAge(TimeSpan? maxAge);
2265

66+
/// <summary>
67+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Path"/> property is the same as provided one.
68+
/// </summary>
69+
/// <param name="path">Expected <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Path"/> property of the cookie.</param>
70+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
2371
IAndResponseCookieTestBuilder WithPath(string path);
2472

73+
/// <summary>
74+
/// Tests whether the <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Secure"/> property is the same as provided one.
75+
/// </summary>
76+
/// <param name="secure">Expected <see cref="Microsoft.Net.Http.Headers.SetCookieHeaderValue.Secure"/> property of the cookie.</param>
77+
/// <returns>The same <see cref="IAndHttpResponseTestBuilder"/>.</returns>
2578
IAndResponseCookieTestBuilder WithSecure(bool secure);
2679
}
2780
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
namespace MyTested.Mvc.Builders.Contracts.Models
22
{
33
/// <summary>
4-
/// Used for adding AndAlso() method to the the model error tests.
4+
/// Used for adding AndAlso() method to the <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> error tests.
55
/// </summary>
66
/// <typeparam name="TModel">Model from invoked action in ASP.NET Core MVC controller.</typeparam>
77
public interface IAndModelErrorTestBuilder<TModel> : IModelErrorTestBuilder<TModel>
88
{
99
/// <summary>
10-
/// AndAlso method for better readability when chaining error message tests.
10+
/// AndAlso method for better readability when chaining <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> error message tests.
1111
/// </summary>
12-
/// <returns>Model error details test builder.</returns>
12+
/// <returns>The same <see cref="IModelErrorTestBuilder{TModel}"/>.</returns>
1313
IModelErrorTestBuilder<TModel> AndAlso();
1414
}
1515
}

src/MyTested.Mvc/Builders/Contracts/Models/IModelDetailsTestBuilder.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
using System;
44

55
/// <summary>
6-
/// Used for testing the response model members.
6+
/// Used for testing the model members.
77
/// </summary>
8-
/// <typeparam name="TResponseModel">Response model from invoked action in ASP.NET Core MVC controller.</typeparam>
8+
/// <typeparam name="TResponseModel">Model from invoked action in ASP.NET Core MVC controller.</typeparam>
99
public interface IModelDetailsTestBuilder<TResponseModel> : IModelErrorTestBuilder<TResponseModel>
1010
{
1111
/// <summary>
12-
/// Tests whether the returned response model from the invoked action passes given assertions.
12+
/// Tests whether the returned model from the invoked action passes given assertions.
1313
/// </summary>
14-
/// <param name="assertions">Action containing all assertions on the response model.</param>
15-
/// <returns>Builder for testing the response model errors.</returns>
14+
/// <param name="assertions">Action containing all assertions on the model.</param>
15+
/// <returns>Test builder of <see cref="IModelErrorTestBuilder{TResponseModel}"/>.</returns>
1616
IModelErrorTestBuilder<TResponseModel> Passing(Action<TResponseModel> assertions);
1717

1818
/// <summary>
19-
/// Tests whether the returned response model from the invoked action passes given predicate.
19+
/// Tests whether the returned model from the invoked action passes given predicate.
2020
/// </summary>
21-
/// <param name="predicate">Predicate testing the response model.</param>
22-
/// <returns>Builder for testing the response model errors.</returns>
21+
/// <param name="predicate">Predicate testing the model.</param>
22+
/// <returns>Test builder of <see cref="IModelErrorTestBuilder{TResponseModel}"/>.</returns>
2323
IModelErrorTestBuilder<TResponseModel> Passing(Func<TResponseModel, bool> predicate);
2424
}
2525
}

src/MyTested.Mvc/Builders/Contracts/Models/IModelErrorDetailsTestBuilder.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,68 @@
55
using Base;
66

77
/// <summary>
8-
/// Used for testing specific model errors.
8+
/// Used for testing specific <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> errors.
99
/// </summary>
1010
/// <typeparam name="TModel">Model from invoked action in ASP.NET Core MVC controller.</typeparam>
1111
public interface IModelErrorDetailsTestBuilder<TModel> : IBaseTestBuilderWithModel<TModel>
1212
{
1313
/// <summary>
14-
/// Tests whether particular error message is equal to given message.
14+
/// Tests whether the error message is equal to given message.
1515
/// </summary>
16-
/// <param name="errorMessage">Expected error message for particular key.</param>
17-
/// <returns>The original model error test builder.</returns>
16+
/// <param name="errorMessage">Expected error message.</param>
17+
/// <returns>Test builder of <see cref="IAndModelErrorTestBuilder{TModel}"/>.</returns>
1818
IAndModelErrorTestBuilder<TModel> ThatEquals(string errorMessage);
1919

2020
/// <summary>
21-
/// Tests whether particular error message begins with given message.
21+
/// Tests whether the error message begins with given message.
2222
/// </summary>
23-
/// <param name="beginMessage">Expected beginning for particular error message.</param>
24-
/// <returns>The original model error test builder.</returns>
23+
/// <param name="beginMessage">Expected beginning for the error message.</param>
24+
/// <returns>Test builder of <see cref="IAndModelErrorTestBuilder{TModel}"/>.</returns>
2525
IAndModelErrorTestBuilder<TModel> BeginningWith(string beginMessage);
2626

2727
/// <summary>
28-
/// Tests whether particular error message ends with given message.
28+
/// Tests whether the error message ends with given message.
2929
/// </summary>
30-
/// <param name="endMessage">Expected ending for particular error message.</param>
31-
/// <returns>The original model error test builder.</returns>
30+
/// <param name="endMessage">Expected ending for the error message.</param>
31+
/// <returns>Test builder of <see cref="IAndModelErrorTestBuilder{TModel}"/>.</returns>
3232
IAndModelErrorTestBuilder<TModel> EndingWith(string endMessage);
3333

3434
/// <summary>
35-
/// Tests whether particular error message contains given message.
35+
/// Tests whether the error message contains given message.
3636
/// </summary>
37-
/// <param name="containsMessage">Expected containing string for particular error message.</param>
38-
/// <returns>The original model error test builder.</returns>
37+
/// <param name="containsMessage">Expected containing string for the error message.</param>
38+
/// <returns>Test builder of <see cref="IAndModelErrorTestBuilder{TModel}"/>.</returns>
3939
IAndModelErrorTestBuilder<TModel> Containing(string containsMessage);
4040

4141
/// <summary>
42-
/// Tests whether tested action's model state contains error by key.
42+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains error by key.
4343
/// </summary>
4444
/// <param name="errorKey">Error key to search for.</param>
45-
/// <returns>Model error details test builder.</returns>
45+
/// <returns>The same <see cref="IModelErrorDetailsTestBuilder{TModel}"/>.</returns>
4646
IModelErrorDetailsTestBuilder<TModel> ContainingError(string errorKey);
4747

4848
/// <summary>
49-
/// Tests whether tested action's model state contains error by member expression.
49+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains error by member expression.
5050
/// </summary>
5151
/// <typeparam name="TMember">Type of the member which will be tested for errors.</typeparam>
5252
/// <param name="memberWithError">Member expression for the tested member.</param>
53-
/// <returns>Model error details test builder.</returns>
53+
/// <returns>The same <see cref="IModelErrorDetailsTestBuilder{TModel}"/>.</returns>
5454
IModelErrorDetailsTestBuilder<TModel> ContainingErrorFor<TMember>(
5555
Expression<Func<TModel, TMember>> memberWithError);
5656

5757
/// <summary>
58-
/// Tests whether tested action's model state contains no error by member expression.
58+
/// Tests whether tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains no error by member expression.
5959
/// </summary>
6060
/// <typeparam name="TMember">Type of the member which will be tested for no errors.</typeparam>
6161
/// <param name="memberWithNoError">Member expression for the tested member.</param>
62-
/// <returns>Model error details test builder.</returns>
62+
/// <returns>Test builder of <see cref="IModelErrorTestBuilder{TModel}"/> type.</returns>
6363
IModelErrorTestBuilder<TModel> ContainingNoErrorFor<TMember>(
6464
Expression<Func<TModel, TMember>> memberWithNoError);
6565

6666
/// <summary>
6767
/// AndAlso method for better readability when chaining error message tests.
6868
/// </summary>
69-
/// <returns>Model error details test builder.</returns>
69+
/// <returns>Test builder of <see cref="IModelErrorTestBuilder{TModel}"/> type.</returns>
7070
IModelErrorTestBuilder<TModel> AndAlso();
7171
}
7272
}

src/MyTested.Mvc/Builders/Contracts/Models/IModelErrorTestBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
using Base;
44

55
/// <summary>
6-
/// Used for testing model errors.
6+
/// Used for testing <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> errors.
77
/// </summary>
88
public interface IModelErrorTestBuilder : IBaseTestBuilderWithInvokedAction
99
{
1010
/// <summary>
11-
/// Tests whether tested action's model state is valid.
11+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> is valid.
1212
/// </summary>
13-
/// <returns>Base test builder.</returns>
13+
/// <returns>Test builder of <see cref="IBaseTestBuilderWithInvokedAction"/> type.</returns>
1414
IBaseTestBuilderWithInvokedAction ContainingNoErrors();
1515
}
1616
}

src/MyTested.Mvc/Builders/Contracts/Models/IModelErrorTestBuilder{TModel}.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@
55
using Base;
66

77
/// <summary>
8-
/// Used for testing model errors.
8+
/// Used for testing <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> errors.
99
/// </summary>
1010
/// <typeparam name="TModel">Model from invoked action in ASP.NET Core MVC controller.</typeparam>
1111
public interface IModelErrorTestBuilder<TModel> : IModelErrorTestBuilder, IBaseTestBuilderWithModel<TModel>
1212
{
1313
/// <summary>
14-
/// Tests whether tested action's model state contains error by key.
14+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains error by key.
1515
/// </summary>
1616
/// <param name="errorKey">Error key to search for.</param>
17-
/// <returns>Model error details test builder.</returns>
17+
/// <returns>Test builder of <see cref="IModelErrorDetailsTestBuilder{TModel}"/> type.</returns>
1818
IModelErrorDetailsTestBuilder<TModel> ContainingError(string errorKey);
1919

2020
/// <summary>
21-
/// Tests whether tested action's model state contains error by member expression.
21+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains error by member expression.
2222
/// </summary>
2323
/// <typeparam name="TMember">Type of the member which will be tested for errors.</typeparam>
2424
/// <param name="memberWithError">Member expression for the tested member.</param>
25-
/// <returns>Model error details test builder.</returns>
25+
/// <returns>Test builder of <see cref="IModelErrorDetailsTestBuilder{TModel}"/> type.</returns>
2626
IModelErrorDetailsTestBuilder<TModel> ContainingErrorFor<TMember>(Expression<Func<TModel, TMember>> memberWithError);
2727

2828
/// <summary>
29-
/// Tests whether tested action's model state contains no error by member expression.
29+
/// Tests whether the tested <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> contains no error by member expression.
3030
/// </summary>
3131
/// <typeparam name="TMember">Type of the member which will be tested for no errors.</typeparam>
3232
/// <param name="memberWithNoError">Member expression for the tested member.</param>
33-
/// <returns>This instance in order to support method chaining.</returns>
33+
/// <returns>The same <see cref="IAndModelErrorTestBuilder{TModel}"/>.</returns>
3434
IAndModelErrorTestBuilder<TModel> ContainingNoErrorFor<TMember>(
3535
Expression<Func<TModel, TMember>> memberWithNoError);
3636
}

src/MyTested.Mvc/Builders/Contracts/Routes/IAndResolvedRouteTestBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public interface IAndResolvedRouteTestBuilder : IResolvedRouteTestBuilder
88
/// <summary>
99
/// AndAlso method for better readability when building route tests.
1010
/// </summary>
11-
/// <returns>The same route builder.</returns>
11+
/// <returns>The same <see cref="IResolvedRouteTestBuilder"/>.</returns>
1212
IResolvedRouteTestBuilder AndAlso();
1313
}
1414
}

0 commit comments

Comments
 (0)