Skip to content

Commit 67f0e29

Browse files
committed
Added xml comments for ActionResultAssertions and AssertionsExtensions.
1 parent d577d4d commit 67f0e29

File tree

2 files changed

+96
-1
lines changed

2 files changed

+96
-1
lines changed

src/FluentAssertions.Mvc3/ActionResultAssertions.cs

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,43 @@
66

77
namespace FluentAssertions.Mvc
88
{
9+
/// <summary>
10+
/// Contains a number of methods to assert that an <see cref="ActionResult"/> is in the expected state.
11+
/// </summary>
912
[DebuggerNonUserCode]
1013
public class ActionResultAssertions : ObjectAssertions
1114
{
1215
public struct Constants
1316
{
1417
public const string CommonFailMessage = "Expected ActionResult to be {0}{reason}, but found {1}";
1518
}
16-
19+
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="T:ActionResultAssertions" /> class.
22+
/// </summary>
1723
public ActionResultAssertions (ActionResult subject) : base(subject)
1824
{
1925
Subject = subject;
2026
}
2127

28+
/// <summary>
29+
/// Asserts that the subject is a <see cref="ContentResult"/>.
30+
/// </summary>
2231
public ContentResultAssertions BeContentResult()
2332
{
2433
return BeContentResult(string.Empty, null);
2534
}
2635

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>
2746
public ContentResultAssertions BeContentResult(string reason, params object[] reasonArgs)
2847
{
2948
Execute.Verification
@@ -34,11 +53,24 @@ public ContentResultAssertions BeContentResult(string reason, params object[] re
3453
return new ContentResultAssertions(Subject as ContentResult);
3554
}
3655

56+
/// <summary>
57+
/// Asserts that the subject is an <see cref="EmptyResult"/>.
58+
/// </summary>
3759
public EmptyResult BeEmptyResult()
3860
{
3961
return BeEmptyResult(string.Empty, null);
4062
}
4163

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>
4274
public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
4375
{
4476
Execute.Verification
@@ -49,11 +81,24 @@ public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
4981
return Subject as EmptyResult;
5082
}
5183

84+
/// <summary>
85+
/// Asserts that the subject is a <see cref="RedirectToRouteResult"/>.
86+
/// </summary>
5287
public RedirectToRouteAssertions BeRedirectToRouteResult()
5388
{
5489
return BeRedirectToRouteResult(string.Empty, null);
5590
}
5691

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>
57102
public RedirectToRouteAssertions BeRedirectToRouteResult(string reason, params object[] reasonArgs)
58103
{
59104
Execute.Verification
@@ -64,11 +109,24 @@ public RedirectToRouteAssertions BeRedirectToRouteResult(string reason, params o
64109
return new RedirectToRouteAssertions(Subject as RedirectToRouteResult);
65110
}
66111

112+
/// <summary>
113+
/// Asserts that the subject is a <see cref="PartialViewResult"/>.
114+
/// </summary>
67115
public PartialViewResultAssertions BePartialViewResult()
68116
{
69117
return BePartialViewResult(string.Empty, null);
70118
}
71119

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>
72130
public PartialViewResultAssertions BePartialViewResult(string reason, params object[] reasonArgs)
73131
{
74132
Execute.Verification
@@ -79,11 +137,24 @@ public PartialViewResultAssertions BePartialViewResult(string reason, params obj
79137
return new PartialViewResultAssertions(Subject as PartialViewResult);
80138
}
81139

140+
/// <summary>
141+
/// Asserts that the subject is a <see cref="RedirectResult"/>.
142+
/// </summary>
82143
public RedirectResultAssertions BeRedirectResult()
83144
{
84145
return BeRedirectResult(string.Empty, null);
85146
}
86147

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>
87158
public RedirectResultAssertions BeRedirectResult(string reason, params object[] reasonArgs)
88159
{
89160
Execute.Verification
@@ -94,11 +165,24 @@ public RedirectResultAssertions BeRedirectResult(string reason, params object[]
94165
return new RedirectResultAssertions(Subject as RedirectResult);
95166
}
96167

168+
/// <summary>
169+
/// Asserts that the subject is a <see cref="ViewResult"/>.
170+
/// </summary>
97171
public ViewResultAssertions BeViewResult()
98172
{
99173
return BeViewResult(string.Empty, null);
100174
}
101175

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>
102186
public ViewResultAssertions BeViewResult(string reason, params object[] reasonArgs)
103187
{
104188
Execute.Verification

src/FluentAssertions.Mvc3/AssertionsExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,25 @@
77

88
namespace FluentAssertions.Mvc
99
{
10+
/// <summary>
11+
/// Contains extension methods for custom assertions in unit tests.
12+
/// </summary>
1013
[DebuggerNonUserCode]
1114
public static class AssertionsExtensions
1215
{
16+
/// <summary>
17+
/// Returns an <see cref="ActionResultAssertions"/> object that can be used to assert the
18+
/// current <see cref="ActionResult"/>.
19+
/// </summary>
1320
public static ActionResultAssertions Should (this ActionResult actual)
1421
{
1522
return new ActionResultAssertions (actual);
1623
}
1724

25+
/// <summary>
26+
/// Returns an <see cref="RouteDataAssertions"/> object that can be used to assert the
27+
/// current <see cref="RouteData"/>.
28+
/// </summary>
1829
public static RouteDataAssertions Should(this RouteData routeData)
1930
{
2031
return new RouteDataAssertions(routeData);

0 commit comments

Comments
 (0)