@@ -26,7 +26,7 @@ public AcceptedAtActionResultAssertions(AcceptedAtActionResult subject) : base(s
2626 /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
2727 /// </param>
2828 /// <param name="reasonArgs">
29- /// Zero or more objects to format using the placeholders in <see cref ="reason" />.
29+ /// Zero or more objects to format using the placeholders in <paramref name ="reason"/>.
3030 /// </param>
3131 public AcceptedAtActionResultAssertions WithActionName ( string expectedActionName , string reason = "" , params object [ ] reasonArgs )
3232 {
@@ -35,7 +35,8 @@ public AcceptedAtActionResultAssertions WithActionName(string expectedActionName
3535 Execute . Assertion
3636 . ForCondition ( string . Equals ( actualActionName , expectedActionName , StringComparison . OrdinalIgnoreCase ) )
3737 . BecauseOf ( reason , reasonArgs )
38- . FailWith ( "Expected AcceptedAtActionResult.ActionName to be {0}{reason} but was {1}" , expectedActionName , actualActionName ) ;
38+ . WithDefaultIdentifier ( "AcceptedAtActionResult.ActionName" )
39+ . FailWith ( FailureMessages . CommonFailMessage , expectedActionName , actualActionName ) ;
3940
4041 return this ;
4142 }
@@ -45,11 +46,11 @@ public AcceptedAtActionResultAssertions WithActionName(string expectedActionName
4546 /// </summary>
4647 /// <param name="expectedControllerName">The expected controller.</param>
4748 /// <param name="reason">
48- /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
49+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
4950 /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
5051 /// </param>
5152 /// <param name="reasonArgs">
52- /// Zero or more objects to format using the placeholders in <see cref ="reason" />.
53+ /// Zero or more objects to format using the placeholders in <paramref name ="reason"/>.
5354 /// </param>
5455 public AcceptedAtActionResultAssertions WithControllerName ( string expectedControllerName , string reason = "" , params object [ ] reasonArgs )
5556 {
@@ -58,7 +59,8 @@ public AcceptedAtActionResultAssertions WithControllerName(string expectedContro
5859 Execute . Assertion
5960 . ForCondition ( string . Equals ( actualControllerName , expectedControllerName , StringComparison . OrdinalIgnoreCase ) )
6061 . BecauseOf ( reason , reasonArgs )
61- . FailWith ( "Expected AcceptedAtActionResult.ControllerName to be {0}{reason} but was {1}" , expectedControllerName , actualControllerName ) ;
62+ . WithDefaultIdentifier ( "AcceptedAtActionResult.ControllerName" )
63+ . FailWith ( FailureMessages . CommonFailMessage , expectedControllerName , actualControllerName ) ;
6264
6365 return this ;
6466 }
@@ -69,27 +71,18 @@ public AcceptedAtActionResultAssertions WithControllerName(string expectedContro
6971 /// <param name="key">The expected key.</param>
7072 /// <param name="expectedValue">The expected value.</param>
7173 /// <param name="reason">
72- /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
74+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
7375 /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
7476 /// </param>
7577 /// <param name="reasonArgs">
76- /// Zero or more objects to format using the placeholders in <see cref ="reason" />.
78+ /// Zero or more objects to format using the placeholders in <paramref name ="reason"/>.
7779 /// </param>
7880 public AcceptedAtActionResultAssertions WithRouteValue ( string key , object expectedValue , string reason = "" , params object [ ] reasonArgs )
7981 {
8082 var subjectTyped = Subject as AcceptedAtActionResult ;
8183
82- Execute . Assertion
83- . ForCondition ( subjectTyped != null && subjectTyped . RouteValues . ContainsKey ( key ) )
84- . BecauseOf ( reason , reasonArgs )
85- . FailWith ( FailureMessages . AcceptedAtActionResult_RouteValues_ContainsKey , key ) ;
86-
87- var actualValue = subjectTyped . RouteValues [ key ] ;
88-
89- Execute . Assertion
90- . ForCondition ( expectedValue . Equals ( actualValue ) )
91- . BecauseOf ( reason , reasonArgs )
92- . FailWith ( FailureMessages . AcceptedAtActionResult_RouteValues_HaveValue , key , expectedValue , actualValue ) ;
84+ AssertionHelpers . AssertStringObjectDictionary ( subjectTyped . RouteValues ,
85+ "AcceptedAtActionResult.RouteValues" , key , expectedValue , reason , reasonArgs ) ;
9386
9487 return this ;
9588 }
@@ -105,11 +98,14 @@ public TValue ValueAs<TValue>()
10598 var value = subjectTyped . Value ;
10699
107100 if ( value == null )
108- Execute . Assertion . FailWith ( FailureMessages . CommonNullWasSuppliedFailMessage , "AcceptedAtActionResult.Value" , typeof ( TValue ) . Name ) ;
101+ Execute . Assertion
102+ . WithDefaultIdentifier ( "AcceptedAtActionResult.Value" )
103+ . FailWith ( FailureMessages . CommonNullWasSuppliedFailMessage , typeof ( TValue ) ) ;
109104
110105 Execute . Assertion
111106 . ForCondition ( value is TValue )
112- . FailWith ( FailureMessages . CommonTypeFailMessage , "AcceptedAtActionResult.Value" , typeof ( TValue ) . Name , value . GetType ( ) . Name ) ;
107+ . WithDefaultIdentifier ( "AcceptedAtActionResult.Value" )
108+ . FailWith ( FailureMessages . CommonTypeFailMessage , typeof ( TValue ) , value . GetType ( ) ) ;
113109
114110 return ( TValue ) value ;
115111 }
0 commit comments