6
6
7
7
namespace FluentAssertions . Mvc
8
8
{
9
+ /// <summary>
10
+ /// Contains a number of methods to assert that an <see cref="ActionResult"/> is in the expected state.
11
+ /// </summary>
9
12
[ DebuggerNonUserCode ]
10
13
public class ActionResultAssertions : ObjectAssertions
11
14
{
12
15
public struct Constants
13
16
{
14
17
public const string CommonFailMessage = "Expected ActionResult to be {0}{reason}, but found {1}" ;
15
18
}
16
-
19
+
20
+ /// <summary>
21
+ /// Initializes a new instance of the <see cref="T:ActionResultAssertions" /> class.
22
+ /// </summary>
17
23
public ActionResultAssertions ( ActionResult subject ) : base ( subject )
18
24
{
19
25
Subject = subject ;
20
26
}
21
27
28
+ /// <summary>
29
+ /// Asserts that the subject is a <see cref="ContentResult"/>.
30
+ /// </summary>
22
31
public ContentResultAssertions BeContentResult ( )
23
32
{
24
33
return BeContentResult ( string . Empty , null ) ;
25
34
}
26
35
36
+ /// <summary>
37
+ /// Asserts that the subject is a <see cref="ContentResult"/>.
38
+ /// </summary>
39
+ /// <param name="reason">
40
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
41
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
42
+ /// </param>
43
+ /// <param name="reasonArgs">
44
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
45
+ /// </param>
27
46
public ContentResultAssertions BeContentResult ( string reason , params object [ ] reasonArgs )
28
47
{
29
48
Execute . Assertion
@@ -34,11 +53,24 @@ public ContentResultAssertions BeContentResult(string reason, params object[] re
34
53
return new ContentResultAssertions ( Subject as ContentResult ) ;
35
54
}
36
55
56
+ /// <summary>
57
+ /// Asserts that the subject is an <see cref="EmptyResult"/>.
58
+ /// </summary>
37
59
public EmptyResult BeEmptyResult ( )
38
60
{
39
61
return BeEmptyResult ( string . Empty , null ) ;
40
62
}
41
63
64
+ /// <summary>
65
+ /// Asserts that the subject is an <see cref="EmptyResult"/>.
66
+ /// </summary>
67
+ /// <param name="reason">
68
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
69
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
70
+ /// </param>
71
+ /// <param name="reasonArgs">
72
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
73
+ /// </param>
42
74
public EmptyResult BeEmptyResult ( string reason , params object [ ] reasonArgs )
43
75
{
44
76
Execute . Assertion
@@ -49,11 +81,24 @@ public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
49
81
return Subject as EmptyResult ;
50
82
}
51
83
84
+ /// <summary>
85
+ /// Asserts that the subject is a <see cref="RedirectToRouteResult"/>.
86
+ /// </summary>
52
87
public RedirectToRouteAssertions BeRedirectToRouteResult ( )
53
88
{
54
89
return BeRedirectToRouteResult ( string . Empty , null ) ;
55
90
}
56
91
92
+ /// <summary>
93
+ /// Asserts that the subject is a <see cref="RedirectToRouteResult"/>.
94
+ /// </summary>
95
+ /// <param name="reason">
96
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
97
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
98
+ /// </param>
99
+ /// <param name="reasonArgs">
100
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
101
+ /// </param>
57
102
public RedirectToRouteAssertions BeRedirectToRouteResult ( string reason , params object [ ] reasonArgs )
58
103
{
59
104
Execute . Assertion
@@ -64,11 +109,24 @@ public RedirectToRouteAssertions BeRedirectToRouteResult(string reason, params o
64
109
return new RedirectToRouteAssertions ( Subject as RedirectToRouteResult ) ;
65
110
}
66
111
112
+ /// <summary>
113
+ /// Asserts that the subject is a <see cref="PartialViewResult"/>.
114
+ /// </summary>
67
115
public PartialViewResultAssertions BePartialViewResult ( )
68
116
{
69
117
return BePartialViewResult ( string . Empty , null ) ;
70
118
}
71
119
120
+ /// <summary>
121
+ /// Asserts that the subject is a <see cref="PartialViewResult"/>.
122
+ /// </summary>
123
+ /// <param name="reason">
124
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
125
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
126
+ /// </param>
127
+ /// <param name="reasonArgs">
128
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
129
+ /// </param>
72
130
public PartialViewResultAssertions BePartialViewResult ( string reason , params object [ ] reasonArgs )
73
131
{
74
132
Execute . Assertion
@@ -79,11 +137,24 @@ public PartialViewResultAssertions BePartialViewResult(string reason, params obj
79
137
return new PartialViewResultAssertions ( Subject as PartialViewResult ) ;
80
138
}
81
139
140
+ /// <summary>
141
+ /// Asserts that the subject is a <see cref="RedirectResult"/>.
142
+ /// </summary>
82
143
public RedirectResultAssertions BeRedirectResult ( )
83
144
{
84
145
return BeRedirectResult ( string . Empty , null ) ;
85
146
}
86
147
148
+ /// <summary>
149
+ /// Asserts that the subject is a <see cref="RedirectResult"/>.
150
+ /// </summary>
151
+ /// <param name="reason">
152
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
153
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
154
+ /// </param>
155
+ /// <param name="reasonArgs">
156
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
157
+ /// </param>
87
158
public RedirectResultAssertions BeRedirectResult ( string reason , params object [ ] reasonArgs )
88
159
{
89
160
Execute . Assertion
@@ -94,11 +165,24 @@ public RedirectResultAssertions BeRedirectResult(string reason, params object[]
94
165
return new RedirectResultAssertions ( Subject as RedirectResult ) ;
95
166
}
96
167
168
+ /// <summary>
169
+ /// Asserts that the subject is a <see cref="ViewResult"/>.
170
+ /// </summary>
97
171
public ViewResultAssertions BeViewResult ( )
98
172
{
99
173
return BeViewResult ( string . Empty , null ) ;
100
174
}
101
175
176
+ /// <summary>
177
+ /// Asserts that the subject is a <see cref="ViewResult"/>.
178
+ /// </summary>
179
+ /// <param name="reason">
180
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
181
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
182
+ /// </param>
183
+ /// <param name="reasonArgs">
184
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
185
+ /// </param>
102
186
public ViewResultAssertions BeViewResult ( string reason , params object [ ] reasonArgs )
103
187
{
104
188
Execute . Assertion
0 commit comments