|
1 | | -using System; |
2 | | -using System.Diagnostics; |
3 | | -using FluentAssertions.Execution; |
4 | | -using FluentAssertions.Primitives; |
| 1 | +using FluentAssertions.Execution; |
5 | 2 | using Microsoft.AspNetCore.Mvc; |
| 3 | +using System; |
| 4 | +using System.Diagnostics; |
6 | 5 |
|
7 | 6 | namespace FluentAssertions.AspNetCore.Mvc |
8 | 7 | { |
9 | 8 | /// <summary> |
10 | 9 | /// Contains a number of methods to assert that a <see cref="CreatedAtRouteResult"/> is in the expected state. |
11 | 10 | /// </summary> |
12 | 11 | [DebuggerNonUserCode] |
13 | | - public class CreatedAtRouteResultAssertions : ObjectAssertions |
| 12 | + public class CreatedAtRouteResultAssertions : ObjectResultAssertionsBase<CreatedAtRouteResult, CreatedAtRouteResultAssertions> |
14 | 13 | { |
15 | 14 | /// <summary> |
16 | 15 | /// Initializes a new instance of the <see cref="CreatedAtRouteResultAssertions" /> class. |
@@ -62,28 +61,5 @@ public CreatedAtRouteResultAssertions WithRouteValue(string key, object expected |
62 | 61 |
|
63 | 62 | return this; |
64 | 63 | } |
65 | | - |
66 | | - /// <summary> |
67 | | - /// Asserts the value is of the expected type. |
68 | | - /// </summary> |
69 | | - /// <typeparam name="TValue">The expected type.</typeparam> |
70 | | - /// <returns>The typed value.</returns> |
71 | | - public TValue ValueAs<TValue>() |
72 | | - { |
73 | | - var subjectTyped = Subject as CreatedAtRouteResult; |
74 | | - var value = subjectTyped.Value; |
75 | | - |
76 | | - if (value == null) |
77 | | - Execute.Assertion |
78 | | - .WithDefaultIdentifier("CreatedAtRouteResult.Value") |
79 | | - .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue)); |
80 | | - |
81 | | - Execute.Assertion |
82 | | - .ForCondition(value is TValue) |
83 | | - .WithDefaultIdentifier("CreatedAtRouteResult.Value") |
84 | | - .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType()); |
85 | | - |
86 | | - return (TValue)value; |
87 | | - } |
88 | 64 | } |
89 | 65 | } |
0 commit comments