9
9
10
10
namespace FluentAssertions . Mvc
11
11
{
12
+ /// <summary>
13
+ /// Contains a number of methods to assert that a <see cref="RedirectToRouteResult"/> is in the expected state.
14
+ /// </summary>
12
15
public class RedirectToRouteAssertions : ReferenceTypeAssertions < RedirectToRouteResult , RedirectToRouteAssertions >
13
16
{
17
+ /// <summary>
18
+ /// Initializes a new instance of the <see cref="T:ContentResultAssertions" /> class.
19
+ /// </summary>
14
20
public RedirectToRouteAssertions ( RedirectToRouteResult subject )
15
21
{
16
22
Subject = subject ;
17
23
}
18
24
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 )
26
37
{
27
38
Execute . Verification
28
39
. BecauseOf ( reason , reasonArgs )
@@ -31,13 +42,18 @@ public RedirectToRouteAssertions WithPermanent(bool expectedPermanent, string re
31
42
return this ;
32
43
}
33
44
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 )
41
57
{
42
58
Execute . Verification
43
59
. BecauseOf ( reason , reasonArgs )
@@ -47,49 +63,70 @@ public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string
47
63
return this ;
48
64
}
49
65
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 )
57
79
{
58
80
Subject . RouteValues . Should ( ) . Contain ( new KeyValuePair < string , object > ( key , expectedValue ) , reason , reasonArgs ) ;
59
81
return this ;
60
82
}
61
83
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 )
69
96
{
70
97
WithRouteValue ( "Controller" , expectedControllerName , reason , reasonArgs ) ;
71
98
return this ;
72
99
}
73
100
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 )
87
113
{
88
- WithArea ( expectedAction , string . Empty , null ) ;
114
+ WithRouteValue ( "Action" , expectedAction , reason , reasonArgs ) ;
89
115
return this ;
90
116
}
91
117
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 )
93
130
{
94
131
WithRouteValue ( "Area" , expectedArea , reason , reasonArgs ) ;
95
132
return this ;
0 commit comments