|
9 | 9 | using Models;
|
10 | 10 |
|
11 | 11 | /// <summary>
|
12 |
| - /// Used for testing action attributes and model state. |
| 12 | + /// Used for testing the action's additional data - action attributes, HTTP response, view bag and more. |
13 | 13 | /// </summary>
|
14 | 14 | /// <typeparam name="TActionResult">Result from invoked action in ASP.NET Core MVC controller.</typeparam>
|
15 | 15 | public interface IShouldHaveTestBuilder<TActionResult> : IBaseTestBuilderWithActionResult<TActionResult>
|
16 | 16 | {
|
17 | 17 | /// <summary>
|
18 |
| - /// Checks whether the tested action has no attributes of any type. |
| 18 | + /// Tests whether the action has no attributes of any type. |
19 | 19 | /// </summary>
|
20 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 20 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
21 | 21 | IAndTestBuilder<TActionResult> NoActionAttributes();
|
22 | 22 |
|
23 | 23 | /// <summary>
|
24 |
| - /// Checks whether the tested action has at least 1 attribute of any type. |
| 24 | + /// Tests whether the action has at least 1 attribute of any type. |
25 | 25 | /// </summary>
|
26 | 26 | /// <param name="withTotalNumberOf">Optional parameter specifying the exact total number of attributes on the tested action.</param>
|
27 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 27 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
28 | 28 | IAndTestBuilder<TActionResult> ActionAttributes(int? withTotalNumberOf = null);
|
29 | 29 |
|
30 | 30 | /// <summary>
|
31 |
| - /// Checks whether the tested action has at specific attributes. |
| 31 | + /// Tests whether the action has specific attributes. |
32 | 32 | /// </summary>
|
33 | 33 | /// <param name="attributesTestBuilder">Builder for testing specific attributes on the action.</param>
|
34 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 34 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
35 | 35 | IAndTestBuilder<TActionResult> ActionAttributes(Action<IActionAttributesTestBuilder> attributesTestBuilder);
|
36 | 36 |
|
37 | 37 | /// <summary>
|
38 |
| - /// Provides way to continue test case with specific model state errors. |
| 38 | + /// Tests whether the action has specific <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> errors. |
39 | 39 | /// </summary>
|
40 | 40 | /// <typeparam name="TRequestModel">Request model type to be tested for errors.</typeparam>
|
41 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 41 | + /// <param name="modelErrorTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> |
| 42 | + /// errors for the provided model type.</param> |
| 43 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
42 | 44 | IAndTestBuilder<TActionResult> ModelStateFor<TRequestModel>(Action<IModelErrorTestBuilder<TRequestModel>> modelErrorTestBuilder);
|
43 | 45 |
|
44 | 46 | /// <summary>
|
45 |
| - /// Checks whether the tested action's provided model state is valid. |
| 47 | + /// Tests whether the action has valid <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> with no errors. |
46 | 48 | /// </summary>
|
47 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 49 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
48 | 50 | IAndTestBuilder<TActionResult> ValidModelState();
|
49 | 51 |
|
50 | 52 | /// <summary>
|
51 |
| - /// Checks whether the tested action's provided model state is not valid. |
| 53 | + /// Tests whether the action has invalid <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>. |
52 | 54 | /// </summary>
|
53 |
| - /// <param name="withNumberOfErrors">Expected number of errors. If default null is provided, the test builder checks only if any errors are found.</param> |
54 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 55 | + /// <param name="withNumberOfErrors">Expected number of <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> errors. |
| 56 | + /// If default null is provided, the test builder checks only if any errors are found.</param> |
| 57 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
55 | 58 | IAndTestBuilder<TActionResult> InvalidModelState(int? withNumberOfErrors = null);
|
56 |
| - |
| 59 | + |
| 60 | + /// <summary> |
| 61 | + /// Tests whether the action sets entries in the <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/>. |
| 62 | + /// </summary> |
| 63 | + /// <param name="withNumberOfEntries">Expected number of <see cref="Microsoft.Extensions.Caching.Memory.IMemoryCache"/> entries. |
| 64 | + /// If default null is provided, the test builder checks only if any entries are found.</param> |
| 65 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
57 | 66 | IAndTestBuilder<TActionResult> MemoryCache(int? withNumberOfEntries = null);
|
58 | 67 |
|
| 68 | + /// <summary> |
| 69 | + /// Tests whether the action sets specific <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> entries. |
| 70 | + /// </summary> |
| 71 | + /// <param name="memoryCacheTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> entries.</param> |
| 72 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
59 | 73 | IAndTestBuilder<TActionResult> MemoryCache(Action<IMemoryCacheTestBuilder> memoryCacheTestBuilder);
|
60 | 74 |
|
| 75 | + /// <summary> |
| 76 | + /// Tests whether the action does not set any <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> entries. |
| 77 | + /// </summary> |
| 78 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
61 | 79 | IAndTestBuilder<TActionResult> NoMemoryCache();
|
62 | 80 |
|
| 81 | + /// <summary> |
| 82 | + /// Tests whether the action sets entries in the <see cref="Microsoft.AspNetCore.Http.Features.ISession"/>. |
| 83 | + /// </summary> |
| 84 | + /// <param name="withNumberOfEntries">Expected number of <see cref="Microsoft.AspNetCore.Http.Features.ISession"/> entries. |
| 85 | + /// If default null is provided, the test builder checks only if any entries are found.</param> |
| 86 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
63 | 87 | IAndTestBuilder<TActionResult> Session(int? withNumberOfEntries = null);
|
64 | 88 |
|
| 89 | + /// <summary> |
| 90 | + /// Tests whether the action sets specific <see cref="Microsoft.AspNetCore.Http.Features.ISession"/> entries. |
| 91 | + /// </summary> |
| 92 | + /// <param name="sessionTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Http.Features.ISession"/> entries.</param> |
| 93 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
65 | 94 | IAndTestBuilder<TActionResult> Session(Action<ISessionTestBuilder> sessionTestBuilder);
|
66 | 95 |
|
| 96 | + /// <summary> |
| 97 | + /// Tests whether the action does not set any <see cref="Microsoft.AspNetCore.Http.Features.ISession"/> entries. |
| 98 | + /// </summary> |
| 99 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
67 | 100 | IAndTestBuilder<TActionResult> NoSession();
|
68 | 101 |
|
| 102 | + /// <summary> |
| 103 | + /// Tests whether the action sets entries in the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary"/>. |
| 104 | + /// </summary> |
| 105 | + /// <param name="withNumberOfEntries">Expected number of <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary"/> entries. |
| 106 | + /// If default null is provided, the test builder checks only if any entries are found.</param> |
| 107 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
69 | 108 | IAndTestBuilder<TActionResult> TempData(int? withNumberOfEntries = null);
|
70 | 109 |
|
| 110 | + /// <summary> |
| 111 | + /// Tests whether the action sets specific entries in the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary"/>. |
| 112 | + /// </summary> |
| 113 | + /// <param name="tempDataTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary"/> entries.</param> |
| 114 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
71 | 115 | IAndTestBuilder<TActionResult> TempData(Action<ITempDataTestBuilder> tempDataTestBuilder);
|
72 | 116 |
|
| 117 | + /// <summary> |
| 118 | + /// Tests whether the action does not set any <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary"/> entries. |
| 119 | + /// </summary> |
| 120 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
73 | 121 | IAndTestBuilder<TActionResult> NoTempData();
|
74 |
| - |
| 122 | + |
| 123 | + /// <summary> |
| 124 | + /// Tests whether the action sets entries in the <see cref="Microsoft.AspNetCore.Mvc.Controller.ViewBag"/>. |
| 125 | + /// </summary> |
| 126 | + /// <param name="withNumberOfEntries">Expected number of <see cref="Microsoft.AspNetCore.Mvc.Controller.ViewBag"/> entries. |
| 127 | + /// If default null is provided, the test builder checks only if any entries are found.</param> |
| 128 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
75 | 129 | IAndTestBuilder<TActionResult> ViewBag(int? withNumberOfEntries = null);
|
76 | 130 |
|
77 |
| - IAndTestBuilder<TActionResult> ViewBag(Action<IViewBagTestBuilder> viewDataTestBuilder); |
| 131 | + /// <summary> |
| 132 | + /// Tests whether the action sets specific entries in the <see cref="Microsoft.AspNetCore.Mvc.Controller.ViewBag"/>. |
| 133 | + /// </summary> |
| 134 | + /// <param name="viewBagTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Mvc.Controller.ViewBag"/> entries.</param> |
| 135 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
| 136 | + IAndTestBuilder<TActionResult> ViewBag(Action<IViewBagTestBuilder> viewBagTestBuilder); |
78 | 137 |
|
| 138 | + /// <summary> |
| 139 | + /// Tests whether the action does not set any <see cref="Microsoft.AspNetCore.Mvc.Controller.ViewBag"/> entries. |
| 140 | + /// </summary> |
| 141 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
79 | 142 | IAndTestBuilder<TActionResult> NoViewBag();
|
80 | 143 |
|
| 144 | + /// <summary> |
| 145 | + /// Tests whether the action sets entries in the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary"/>. |
| 146 | + /// </summary> |
| 147 | + /// <param name="withNumberOfEntries">Expected number of <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary"/> entries. |
| 148 | + /// If default null is provided, the test builder checks only if any entries are found.</param> |
| 149 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
81 | 150 | IAndTestBuilder<TActionResult> ViewData(int? withNumberOfEntries = null);
|
82 | 151 |
|
| 152 | + /// <summary> |
| 153 | + /// Tests whether the action sets specific entries in the <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary"/>. |
| 154 | + /// </summary> |
| 155 | + /// <param name="viewBagTestBuilder">Builder for testing specific <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary"/> entries.</param> |
| 156 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
83 | 157 | IAndTestBuilder<TActionResult> ViewData(Action<IViewDataTestBuilder> viewDataTestBuilder);
|
84 | 158 |
|
| 159 | + /// <summary> |
| 160 | + /// Tests whether the action does not set any <see cref="Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary"/> entries. |
| 161 | + /// </summary> |
| 162 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
85 | 163 | IAndTestBuilder<TActionResult> NoViewData();
|
86 | 164 |
|
87 | 165 | /// <summary>
|
88 |
| - /// Checks whether the tested action applies additional features to the HTTP response. |
| 166 | + /// Tests whether the action applies additional features to the HTTP response. |
89 | 167 | /// </summary>
|
90 |
| - /// <returns>Test builder with AndAlso method.</returns> |
| 168 | + /// <returns>Test builder of <see cref="IAndTestBuilder<TActionResult>"/> type.</returns> |
91 | 169 | IAndTestBuilder<TActionResult> HttpResponse(Action<IHttpResponseTestBuilder> httpResponseTestBuilder);
|
92 | 170 | }
|
93 | 171 | }
|
0 commit comments