99
1010namespace FluentAssertions . Mvc
1111{
12+ /// <summary>
13+ /// Contains a number of methods to assert that a <see cref="RedirectToRouteResult"/> is in the expected state.
14+ /// </summary>
1215 public class RedirectToRouteAssertions : ReferenceTypeAssertions < RedirectToRouteResult , RedirectToRouteAssertions >
1316 {
17+ /// <summary>
18+ /// Initializes a new instance of the <see cref="T:ContentResultAssertions" /> class.
19+ /// </summary>
1420 public RedirectToRouteAssertions ( RedirectToRouteResult subject )
1521 {
1622 Subject = subject ;
1723 }
1824
19- public RedirectToRouteAssertions WithPermanent ( bool expectedPermanent )
20- {
21- WithPermanent ( expectedPermanent , string . Empty , null ) ;
22- return this ;
23- }
24-
25- public RedirectToRouteAssertions WithPermanent ( bool expectedPermanent , string reason , params object [ ] reasonArgs )
25+ /// <summary>
26+ /// Asserts that the redirect is permanent.
27+ /// </summary>
28+ /// <param name="expectedPermanent">Should the redirect be permanent.</param>
29+ /// <param name="reason">
30+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
31+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
32+ /// </param>
33+ /// <param name="reasonArgs">
34+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
35+ /// </param>
36+ public RedirectToRouteAssertions WithPermanent ( bool expectedPermanent , string reason = "" , params object [ ] reasonArgs )
2637 {
2738 Execute . Verification
2839 . BecauseOf ( reason , reasonArgs )
@@ -31,13 +42,18 @@ public RedirectToRouteAssertions WithPermanent(bool expectedPermanent, string re
3142 return this ;
3243 }
3344
34- public RedirectToRouteAssertions WithRouteName ( string expectedRouteName )
35- {
36- WithRouteName ( expectedRouteName , string . Empty , null ) ;
37- return this ;
38- }
39-
40- public RedirectToRouteAssertions WithRouteName ( string expectedRouteName , string reason , params object [ ] reasonArgs )
45+ /// <summary>
46+ /// Asserts that the redirect has the expected route name.
47+ /// </summary>
48+ /// <param name="expectedRouteName">The expected route name.</param>
49+ /// <param name="reason">
50+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
51+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
52+ /// </param>
53+ /// <param name="reasonArgs">
54+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
55+ /// </param>
56+ public RedirectToRouteAssertions WithRouteName ( string expectedRouteName , string reason = "" , params object [ ] reasonArgs )
4157 {
4258 Execute . Verification
4359 . BecauseOf ( reason , reasonArgs )
@@ -47,49 +63,70 @@ public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string
4763 return this ;
4864 }
4965
50- public RedirectToRouteAssertions WithRouteValue ( string key , object expectedValue )
51- {
52- WithRouteValue ( key , expectedValue , string . Empty , null ) ;
53- return this ;
54- }
55-
56- public RedirectToRouteAssertions WithRouteValue ( string key , object expectedValue , string reason , params object [ ] reasonArgs )
66+ /// <summary>
67+ /// Asserts that the redirect has the expected route value.
68+ /// </summary>
69+ /// <param name="key">The expected route value key.</param>
70+ /// <param name="expectedValue">The expected route value.</param>
71+ /// <param name="reason">
72+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
73+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
74+ /// </param>
75+ /// <param name="reasonArgs">
76+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
77+ /// </param>
78+ public RedirectToRouteAssertions WithRouteValue ( string key , object expectedValue , string reason = "" , params object [ ] reasonArgs )
5779 {
5880 Subject . RouteValues . Should ( ) . Contain ( new KeyValuePair < string , object > ( key , expectedValue ) , reason , reasonArgs ) ;
5981 return this ;
6082 }
6183
62- public RedirectToRouteAssertions WithController ( string expectedControllerName )
63- {
64- WithController ( expectedControllerName , string . Empty , null ) ;
65- return this ;
66- }
67-
68- public RedirectToRouteAssertions WithController ( string expectedControllerName , string reason , params object [ ] reasonArgs )
84+ /// <summary>
85+ /// Asserts that the redirect has the expected controller name.
86+ /// </summary>
87+ /// <param name="expectedControllerName">The expected controller name.</param>
88+ /// <param name="reason">
89+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
90+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
91+ /// </param>
92+ /// <param name="reasonArgs">
93+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
94+ /// </param>
95+ public RedirectToRouteAssertions WithController ( string expectedControllerName , string reason = "" , params object [ ] reasonArgs )
6996 {
7097 WithRouteValue ( "Controller" , expectedControllerName , reason , reasonArgs ) ;
7198 return this ;
7299 }
73100
74- public RedirectToRouteAssertions WithAction ( string expectedAction )
75- {
76- WithAction ( expectedAction , string . Empty , null ) ;
77- return this ;
78- }
79-
80- public RedirectToRouteAssertions WithAction ( string expectedArea , string reason , params object [ ] reasonArgs )
81- {
82- WithRouteValue ( "Action" , expectedArea , reason , reasonArgs ) ;
83- return this ;
84- }
85-
86- public RedirectToRouteAssertions WithArea ( string expectedAction )
101+ /// <summary>
102+ /// Asserts that the redirect has the expected action.
103+ /// </summary>
104+ /// <param name="expectedAction">The expected action.</param>
105+ /// <param name="reason">
106+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
107+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
108+ /// </param>
109+ /// <param name="reasonArgs">
110+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
111+ /// </param>
112+ public RedirectToRouteAssertions WithAction ( string expectedAction , string reason = "" , params object [ ] reasonArgs )
87113 {
88- WithArea ( expectedAction , string . Empty , null ) ;
114+ WithRouteValue ( "Action" , expectedAction , reason , reasonArgs ) ;
89115 return this ;
90116 }
91117
92- public RedirectToRouteAssertions WithArea ( string expectedArea , string reason , params object [ ] reasonArgs )
118+ /// <summary>
119+ /// Asserts that the redirect has the expected area.
120+ /// </summary>
121+ /// <param name="expectedArea">The expected area.</param>
122+ /// <param name="reason">
123+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
124+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
125+ /// </param>
126+ /// <param name="reasonArgs">
127+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
128+ /// </param>
129+ public RedirectToRouteAssertions WithArea ( string expectedArea , string reason = "" , params object [ ] reasonArgs )
93130 {
94131 WithRouteValue ( "Area" , expectedArea , reason , reasonArgs ) ;
95132 return this ;
0 commit comments