1
- using System . Diagnostics ;
2
- using FluentAssertions . Execution ;
3
- using FluentAssertions . Primitives ;
4
- using Microsoft . AspNetCore . Mvc ;
1
+ using Microsoft . AspNetCore . Mvc ;
2
+ using System . Diagnostics ;
5
3
6
4
namespace FluentAssertions . AspNetCore . Mvc
7
5
{
8
6
/// <summary>
9
7
/// Contains a number of methods to assert that a <see cref="NotFoundObjectResult"/> is in the expected state.
10
8
/// </summary>
11
9
[ DebuggerNonUserCode ]
12
- public class NotFoundObjectResultAssertions : ObjectAssertions
10
+ public class NotFoundObjectResultAssertions : ObjectResultAssertionsBase < NotFoundObjectResult , NotFoundObjectResultAssertions >
13
11
{
14
12
#region Public Constructors
15
13
@@ -22,42 +20,5 @@ public NotFoundObjectResultAssertions(NotFoundObjectResult subject) : base(subje
22
20
}
23
21
24
22
#endregion
25
-
26
- #region Public Properties
27
- /// <summary>
28
- /// The value on the NotFoundObjectResult
29
- /// </summary>
30
- public object Value => NotFoundObjectResultSubject . Value ;
31
-
32
- #endregion
33
-
34
- #region Private Properties
35
- private NotFoundObjectResult NotFoundObjectResultSubject => ( NotFoundObjectResult ) Subject ;
36
-
37
- #endregion
38
-
39
- #region Public Methods
40
- /// <summary>
41
- /// Asserts the value is of the expected type.
42
- /// </summary>
43
- /// <typeparam name="TValue">The expected type.</typeparam>
44
- /// <returns>The typed value.</returns>
45
- public TValue ValueAs < TValue > ( )
46
- {
47
- var value = NotFoundObjectResultSubject . Value ;
48
-
49
- if ( value == null )
50
- Execute . Assertion
51
- . WithDefaultIdentifier ( "NotFoundObjectResult.Value" )
52
- . FailWith ( FailureMessages . CommonNullWasSuppliedFailMessage , typeof ( TValue ) ) ;
53
-
54
- Execute . Assertion
55
- . ForCondition ( value is TValue )
56
- . WithDefaultIdentifier ( "NotFoundObjectResult.Value" )
57
- . FailWith ( FailureMessages . CommonTypeFailMessage , typeof ( TValue ) , value . GetType ( ) ) ;
58
-
59
- return ( TValue ) value ;
60
- }
61
- #endregion
62
23
}
63
24
}
0 commit comments