diff --git a/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtActionResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtActionResultAssertions.cs
index b05f417..c935e6f 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtActionResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtActionResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class AcceptedAtActionResultAssertions : ObjectAssertions
+ public class AcceptedAtActionResultAssertions : ObjectResultAssertionsBase
{
///
/// Initializes a new instance of the class.
@@ -30,7 +29,7 @@ public AcceptedAtActionResultAssertions(AcceptedAtActionResult subject) : base(s
///
public AcceptedAtActionResultAssertions WithActionName(string expectedActionName, string reason = "", params object[] reasonArgs)
{
- string actualActionName = (Subject as AcceptedAtActionResult)?.ActionName;
+ string actualActionName = ObjectResultSubject.ActionName;
Execute.Assertion
.ForCondition(string.Equals(actualActionName, expectedActionName, StringComparison.OrdinalIgnoreCase))
@@ -54,7 +53,7 @@ public AcceptedAtActionResultAssertions WithActionName(string expectedActionName
///
public AcceptedAtActionResultAssertions WithControllerName(string expectedControllerName, string reason = "", params object[] reasonArgs)
{
- string actualControllerName = (Subject as AcceptedAtActionResult)?.ControllerName;
+ string actualControllerName = ObjectResultSubject.ControllerName;
Execute.Assertion
.ForCondition(string.Equals(actualControllerName, expectedControllerName, StringComparison.OrdinalIgnoreCase))
@@ -79,35 +78,12 @@ public AcceptedAtActionResultAssertions WithControllerName(string expectedContro
///
public AcceptedAtActionResultAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
- var subjectTyped = Subject as AcceptedAtActionResult;
+ var actualRouteValues = ObjectResultSubject.RouteValues;
- AssertionHelpers.AssertStringObjectDictionary(subjectTyped.RouteValues,
+ AssertionHelpers.AssertStringObjectDictionary(actualRouteValues,
"AcceptedAtActionResult.RouteValues", key, expectedValue, reason, reasonArgs);
return this;
}
-
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var subjectTyped = Subject as AcceptedAtActionResult;
- var value = subjectTyped.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("AcceptedAtActionResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("AcceptedAtActionResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtRouteResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtRouteResultAssertions.cs
index 1b4d9ef..e02e7ac 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtRouteResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/AcceptedAtRouteResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class AcceptedAtRouteResultAssertions : ObjectAssertions
+ public class AcceptedAtRouteResultAssertions : ObjectResultAssertionsBase
{
///
/// Initializes a new instance of the class.
@@ -30,13 +29,13 @@ public AcceptedAtRouteResultAssertions(AcceptedAtRouteResult subject) : base(sub
///
public AcceptedAtRouteResultAssertions WithRouteName(string expectedRouteName, string reason = "", params object[] reasonArgs)
{
- var subjectTyped = Subject as AcceptedAtRouteResult;
+ var actualRouteName = ObjectResultSubject.RouteName;
Execute.Assertion
.BecauseOf(reason, reasonArgs)
- .ForCondition(string.Equals(expectedRouteName, subjectTyped.RouteName, StringComparison.OrdinalIgnoreCase))
+ .ForCondition(string.Equals(expectedRouteName, actualRouteName, StringComparison.OrdinalIgnoreCase))
.WithDefaultIdentifier("AcceptedAtRouteResult.RouteName")
- .FailWith(FailureMessages.CommonFailMessage, expectedRouteName, subjectTyped.RouteName);
+ .FailWith(FailureMessages.CommonFailMessage, expectedRouteName, actualRouteName);
return this;
}
@@ -55,35 +54,12 @@ public AcceptedAtRouteResultAssertions WithRouteName(string expectedRouteName, s
///
public AcceptedAtRouteResultAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
- var subjectTyped = Subject as AcceptedAtRouteResult;
+ var actualRouteValues = ObjectResultSubject.RouteValues;
- AssertionHelpers.AssertStringObjectDictionary(subjectTyped.RouteValues,
+ AssertionHelpers.AssertStringObjectDictionary(actualRouteValues,
"AcceptedAtRouteResult.RouteValues", key, expectedValue, reason, reasonArgs);
return this;
}
-
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var subjectTyped = Subject as AcceptedAtRouteResult;
- var value = subjectTyped.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("AcceptedAtRouteResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("AcceptedAtRouteResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/AcceptedResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/AcceptedResultAssertions.cs
index 93c7881..8cdc038 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/AcceptedResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/AcceptedResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class AcceptedResultAssertions : ObjectAssertions
+ public class AcceptedResultAssertions : ObjectResultAssertionsBase
{
#region Public Constructors
@@ -26,42 +25,13 @@ public AcceptedResultAssertions(AcceptedResult subject) : base(subject)
#region Public Properties
///
- /// The value on the AcceptedResult
+ /// The location on the AcceptedResult.
///
- public object Value => AcceptedResultSubject.Value;
-
- public string Location => AcceptedResultSubject.Location;
-
- #endregion
-
- #region Private Properties
- private AcceptedResult AcceptedResultSubject => (AcceptedResult)Subject;
+ public string Location => ObjectResultSubject.Location;
#endregion
#region Public Methods
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var value = AcceptedResultSubject.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("AcceptedResultAssertions.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("AcceptedResultAssertions.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
-
///
/// Asserts the uri has the expected value.
///
@@ -83,7 +53,7 @@ public AcceptedResultAssertions WithUri(Uri uri, string reason = "", params obje
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(expectedUri == Location)
- .WithDefaultIdentifier("AcceptedResultAssertions.Uri")
+ .WithDefaultIdentifier("AcceptedResult.Uri")
.FailWith(FailureMessages.CommonFailMessage, expectedUri, Location);
return this;
@@ -108,7 +78,7 @@ public AcceptedResultAssertions WithUri(string uri, string reason = "", params o
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(uri == Location)
- .WithDefaultIdentifier("AcceptedResultAssertions.Uri")
+ .WithDefaultIdentifier("AcceptedResult.Uri")
.FailWith(FailureMessages.CommonFailMessage, uri, Location);
return this;
diff --git a/src/FluentAssertions.AspNetCore.Mvc/ActionResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/ActionResultAssertions.cs
index f893caa..47466f1 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/ActionResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/ActionResultAssertions.cs
@@ -24,7 +24,9 @@ public ActionResultAssertions(IActionResult subject) : base(subject)
#endregion Public Constructors
#region Protected Properties
-
+ ///
+ ///
+ ///
protected override string Identifier => "ActionResult";
#endregion Protected Properties
@@ -325,6 +327,27 @@ public StatusCodeResultAssertions BeStatusCodeResult(string reason = "", params
return new StatusCodeResultAssertions(Subject as StatusCodeResult);
}
+ ///
+ /// Asserts that the subject is a .
+ ///
+ ///
+ /// A formatted phrase as is supported by explaining why the assertion
+ /// is needed. If the phrase does not start with the word because, it is prepended automatically.
+ ///
+ ///
+ /// Zero or more objects to format using the placeholders in .
+ ///
+ [CustomAssertion]
+ public ObjectResultAssertions BeObjectResult(string reason = "", params object[] reasonArgs)
+ {
+ Execute.Assertion
+ .BecauseOf(reason, reasonArgs)
+ .ForCondition(Subject is ObjectResult)
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(ObjectResult), Subject.GetType());
+
+ return new ObjectResultAssertions(Subject as ObjectResult);
+ }
+
///
/// Asserts that the subject is an .
///
@@ -362,7 +385,7 @@ public OkObjectResultAssertions BeOkObjectResult(string reason = "", params obje
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is OkObjectResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(OkObjectResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(OkObjectResult), Subject.GetType());
return new OkObjectResultAssertions(Subject as OkObjectResult);
}
@@ -404,7 +427,7 @@ public BadRequestObjectResultAssertions BeBadRequestObjectResult(string reason =
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is BadRequestObjectResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(BadRequestObjectResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(BadRequestObjectResult), Subject.GetType());
return new BadRequestObjectResultAssertions(Subject as BadRequestObjectResult);
}
@@ -425,7 +448,7 @@ public CreatedResultAssertions BeCreatedResult(string reason = "", params object
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is CreatedResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedResult), Subject.GetType());
return new CreatedResultAssertions(Subject as CreatedResult);
}
@@ -488,7 +511,7 @@ public ForbidResultAssertions BeForbidResult(string reason = "", params object[]
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is ForbidResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(ForbidResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(ForbidResult), Subject.GetType());
return new ForbidResultAssertions(Subject as ForbidResult);
}
@@ -551,7 +574,7 @@ public NotFoundObjectResultAssertions BeNotFoundObjectResult(string reason = "",
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is NotFoundObjectResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(NotFoundObjectResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(NotFoundObjectResult), Subject.GetType());
return new NotFoundObjectResultAssertions(Subject as NotFoundObjectResult);
}
@@ -593,7 +616,7 @@ public SignInResultAssertions BeSignInResult(string reason = "", params object[]
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is SignInResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(SignInResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(SignInResult), Subject.GetType());
return new SignInResultAssertions(Subject as SignInResult);
}
@@ -656,7 +679,7 @@ public AcceptedAtActionResultAssertions BeAcceptedAtActionResult(string reason =
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is AcceptedAtActionResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(AcceptedAtActionResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(AcceptedAtActionResult), Subject.GetType());
return new AcceptedAtActionResultAssertions(Subject as AcceptedAtActionResult);
}
@@ -677,7 +700,7 @@ public AcceptedAtRouteResultAssertions BeAcceptedAtRouteResult(string reason = "
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is AcceptedAtRouteResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(AcceptedAtRouteResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(AcceptedAtRouteResult), Subject.GetType());
return new AcceptedAtRouteResultAssertions(Subject as AcceptedAtRouteResult);
}
@@ -698,7 +721,7 @@ public CreatedAtActionResultAssertions BeCreatedAtActionResult(string reason = "
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is CreatedAtActionResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedAtActionResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedAtActionResult), Subject.GetType());
return new CreatedAtActionResultAssertions(Subject as CreatedAtActionResult);
}
@@ -719,7 +742,7 @@ public CreatedAtRouteResultAssertions BeCreatedAtRouteResult(string reason = "",
Execute.Assertion
.BecauseOf(reason, reasonArgs)
.ForCondition(Subject is CreatedAtRouteResult)
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedAtRouteResult).Name, Subject.GetType().Name);
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(CreatedAtRouteResult), Subject.GetType());
return new CreatedAtRouteResultAssertions(Subject as CreatedAtRouteResult);
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/ChallengeResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/ChallengeResultAssertions.cs
index e8fc98b..f85a156 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/ChallengeResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/ChallengeResultAssertions.cs
@@ -29,13 +29,44 @@ public ChallengeResultAssertions(object subject) : base(subject)
#endregion
#region Public Properties
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public AuthenticationProperties AuthenticationProperties => ChallengeResultSubject.Properties;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public IDictionary Items => ChallengeResultSubject.Properties?.Items;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public bool IsPersistent => ChallengeResultSubject.Properties?.IsPersistent ?? false;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public string RedirectUri => ChallengeResultSubject.Properties?.RedirectUri;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public DateTimeOffset? IssuedUtc => ChallengeResultSubject.Properties?.IssuedUtc;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public DateTimeOffset? ExpiresUtc => ChallengeResultSubject.Properties?.ExpiresUtc;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public bool? AllowRefresh => ChallengeResultSubject.Properties?.AllowRefresh;
+
+ ///
+ /// The that belongs to the ChallengeResult.
+ ///
public IList AuthenticationSchemes => ChallengeResultSubject.AuthenticationSchemes;
#endregion
diff --git a/src/FluentAssertions.AspNetCore.Mvc/CreatedAtActionResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/CreatedAtActionResultAssertions.cs
index 2ef6c83..dfda3c8 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/CreatedAtActionResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/CreatedAtActionResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class CreatedAtActionResultAssertions : ObjectAssertions
+ public class CreatedAtActionResultAssertions : ObjectResultAssertionsBase
{
///
/// Initializes a new instance of the class.
@@ -30,7 +29,7 @@ public CreatedAtActionResultAssertions(CreatedAtActionResult subject) : base(sub
///
public CreatedAtActionResultAssertions WithActionName(string expectedActionName, string reason = "", params object[] reasonArgs)
{
- string actualActionName = (Subject as CreatedAtActionResult)?.ActionName;
+ string actualActionName = ObjectResultSubject.ActionName;
Execute.Assertion
.ForCondition(string.Equals(actualActionName, expectedActionName, StringComparison.OrdinalIgnoreCase))
@@ -54,7 +53,7 @@ public CreatedAtActionResultAssertions WithActionName(string expectedActionName,
///
public CreatedAtActionResultAssertions WithControllerName(string expectedControllerName, string reason = "", params object[] reasonArgs)
{
- string actualControllerName = (Subject as CreatedAtActionResult)?.ControllerName;
+ string actualControllerName = ObjectResultSubject.ControllerName;
Execute.Assertion
.ForCondition(string.Equals(actualControllerName, expectedControllerName, StringComparison.OrdinalIgnoreCase))
@@ -79,35 +78,12 @@ public CreatedAtActionResultAssertions WithControllerName(string expectedControl
///
public CreatedAtActionResultAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
- var subjectTyped = Subject as CreatedAtActionResult;
+ var actualRouteValues = ObjectResultSubject.RouteValues;
- AssertionHelpers.AssertStringObjectDictionary(subjectTyped.RouteValues, "CreatedAtActionResult.RouteValues",
+ AssertionHelpers.AssertStringObjectDictionary(actualRouteValues, "CreatedAtActionResult.RouteValues",
key, expectedValue, reason, reasonArgs);
return this;
}
-
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var subjectTyped = Subject as CreatedAtActionResult;
- var value = subjectTyped.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("CreatedAtActionResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("CreatedAtActionResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/CreatedAtRouteResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/CreatedAtRouteResultAssertions.cs
index c3e0fcf..afed025 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/CreatedAtRouteResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/CreatedAtRouteResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class CreatedAtRouteResultAssertions : ObjectAssertions
+ public class CreatedAtRouteResultAssertions : ObjectResultAssertionsBase
{
///
/// Initializes a new instance of the class.
@@ -62,28 +61,5 @@ public CreatedAtRouteResultAssertions WithRouteValue(string key, object expected
return this;
}
-
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var subjectTyped = Subject as CreatedAtRouteResult;
- var value = subjectTyped.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("CreatedAtRouteResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("CreatedAtRouteResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/CreatedResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/CreatedResultAssertions.cs
index 22e21b5..7f98520 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/CreatedResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/CreatedResultAssertions.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
+using FluentAssertions.Execution;
using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -10,7 +9,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class CreatedResultAssertions : ObjectAssertions
+ public class CreatedResultAssertions : ObjectResultAssertionsBase
{
#region Public Constructors
@@ -26,42 +25,13 @@ public CreatedResultAssertions(CreatedResult subject) : base(subject)
#region Public Properties
///
- /// The value on the CreatedResult
+ /// The location on the CreatedResult.
///
- public object Value => CreatedResultSubject.Value;
-
- public string Location => CreatedResultSubject.Location;
-
- #endregion
-
- #region Private Properties
- private CreatedResult CreatedResultSubject => (CreatedResult)Subject;
+ public string Location => ObjectResultSubject.Location;
#endregion
#region Public Methods
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var value = CreatedResultSubject.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("CreatedResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("CreatedResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
-
///
/// Asserts the uri has the expected value.
///
diff --git a/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.Designer.cs b/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.Designer.cs
index 7aa234b..8b79535 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.Designer.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.Designer.cs
@@ -106,7 +106,7 @@ internal static string CommonNullWasSuppliedFailMessage {
}
///
- /// Looks up a localized string similar to Expected {context} to be of type {0} but was {1}..
+ /// Looks up a localized string similar to Expected {context} to be of type {0} but was {1}{reason}..
///
internal static string CommonTypeFailMessage {
get {
diff --git a/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.resx b/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.resx
index d62f4d3..986832e 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.resx
+++ b/src/FluentAssertions.AspNetCore.Mvc/FailureMessages.resx
@@ -133,7 +133,7 @@
Expected {context} to be of type {0}, but no value was supplied.
- Expected {context} to be of type {0} but was {1}.
+ Expected {context} to be of type {0} but was {1}{reason}.Expected {context} to be ActionResult<TValue> with type {0}{reason} but was {1}.
diff --git a/src/FluentAssertions.AspNetCore.Mvc/FluentAssertions.AspNetCore.Mvc.csproj b/src/FluentAssertions.AspNetCore.Mvc/FluentAssertions.AspNetCore.Mvc.csproj
index df0dc4e..4222a96 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/FluentAssertions.AspNetCore.Mvc.csproj
+++ b/src/FluentAssertions.AspNetCore.Mvc/FluentAssertions.AspNetCore.Mvc.csproj
@@ -5,12 +5,12 @@
Copyright 2018Fluent Assertions extensions for ASP.NET Core MVCFluent Assertions for ASP.NET Core MVC
- 3.0.0
+ 3.1.0Casey Burns;Kevin Kuszyknetstandard2.0;netcoreapp3.0FluentAssertions.AspNetCore.MvcFluentAssertions.AspNetCore.Mvc
- TDD;TDD;Fluent;Mvc;AspNetMvc;aspnetcore;aspnetcoremvc
+ TDD;Fluent;Mvc;AspNetMvc;aspnetcore;aspnetcoremvcSee https://github.com/fluentassertions/fluentassertions.aspnetcore.mvc/releases https://github.com/fluentassertions/fluentassertions.aspnetcore.mvchttps://github.com/fluentassertions/fluentassertions.aspnetcore.mvc/blob/master/license.txt
diff --git a/src/FluentAssertions.AspNetCore.Mvc/ForbidResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/ForbidResultAssertions.cs
index 99ba954..9093bd2 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/ForbidResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/ForbidResultAssertions.cs
@@ -28,13 +28,45 @@ public ForbidResultAssertions(ForbidResult subject) : base(subject)
#endregion
#region Public Properties
+
+ ///
+ /// The authentication properties on the ForbidResult.
+ ///
public AuthenticationProperties AuthenticationProperties => ForbidResultSubject.Properties;
+
+ ///
+ /// The items value in the authentication properties on the ForbidResult.
+ ///
public IDictionary Items => ForbidResultSubject.Properties?.Items;
+
+ ///
+ /// The is persistent value in the authentication properties on the ForbidResult.
+ ///
public bool IsPersistent => ForbidResultSubject.Properties?.IsPersistent ?? false;
+
+ ///
+ /// The redirect uri value in the authentication properties on the ForbidResult.
+ ///
public string RedirectUri => ForbidResultSubject.Properties?.RedirectUri;
+
+ ///
+ /// The issued utc value in the authentication properties on the ForbidResult.
+ ///
public DateTimeOffset? IssuedUtc => ForbidResultSubject.Properties?.IssuedUtc;
+
+ ///
+ /// The expires utc value in the authentication properties on the ForbidResult.
+ ///
public DateTimeOffset? ExpiresUtc => ForbidResultSubject.Properties?.ExpiresUtc;
+
+ ///
+ /// The allow refresh value in the authentication properties on the ForbidResult.
+ ///
public bool? AllowRefresh => ForbidResultSubject.Properties?.AllowRefresh;
+
+ ///
+ /// The authentication schemes value on the ForbidResult.
+ ///
public IList AuthenticationSchemes => ForbidResultSubject.AuthenticationSchemes;
#endregion
diff --git a/src/FluentAssertions.AspNetCore.Mvc/NotFoundObjectResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/NotFoundObjectResultAssertions.cs
index c70d8b6..372f084 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/NotFoundObjectResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/NotFoundObjectResultAssertions.cs
@@ -1,7 +1,5 @@
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -9,7 +7,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class NotFoundObjectResultAssertions : ObjectAssertions
+ public class NotFoundObjectResultAssertions : ObjectResultAssertionsBase
{
#region Public Constructors
@@ -22,42 +20,5 @@ public NotFoundObjectResultAssertions(NotFoundObjectResult subject) : base(subje
}
#endregion
-
- #region Public Properties
- ///
- /// The value on the NotFoundObjectResult
- ///
- public object Value => NotFoundObjectResultSubject.Value;
-
- #endregion
-
- #region Private Properties
- private NotFoundObjectResult NotFoundObjectResultSubject => (NotFoundObjectResult)Subject;
-
- #endregion
-
- #region Public Methods
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var value = NotFoundObjectResultSubject.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("NotFoundObjectResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("NotFoundObjectResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
- #endregion
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertions.cs
new file mode 100644
index 0000000..e6d4034
--- /dev/null
+++ b/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertions.cs
@@ -0,0 +1,24 @@
+using Microsoft.AspNetCore.Mvc;
+using System.Diagnostics;
+
+namespace FluentAssertions.AspNetCore.Mvc
+{
+ ///
+ /// Contains a number of methods to assert that a is in the expected state.
+ ///
+ [DebuggerNonUserCode]
+ public class ObjectResultAssertions : ObjectResultAssertionsBase
+ {
+ #region Public Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The object to test assertion on
+ public ObjectResultAssertions(ObjectResult subject)
+ : base(subject)
+ {
+
+ }
+ #endregion
+ }
+}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertionsBase.cs b/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertionsBase.cs
new file mode 100644
index 0000000..25a76a4
--- /dev/null
+++ b/src/FluentAssertions.AspNetCore.Mvc/ObjectResultAssertionsBase.cs
@@ -0,0 +1,195 @@
+using FluentAssertions.Execution;
+using FluentAssertions.Primitives;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using System;
+using System.Diagnostics;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace FluentAssertions.AspNetCore.Mvc
+{
+ ///
+ /// Base class for .
+ ///
+ [DebuggerNonUserCode]
+ public class ObjectResultAssertionsBase : ObjectAssertions
+ where TObjectResult : ObjectResult
+ where TObjectResultAssertion : ObjectResultAssertionsBase
+ {
+ #region Public Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The object to test assertion on
+ public ObjectResultAssertionsBase(TObjectResult subject)
+ : base(subject)
+ {
+
+ }
+ #endregion
+
+ #region Public Properties
+
+ ///
+ /// The value on the ObjectResult
+ ///
+ public object Value => ObjectResultSubject.Value;
+
+ #endregion
+
+ #region Protected Properties
+
+ ///
+ protected override string Identifier => typeof(TObjectResult).Name;
+ ///
+ /// The casted to the correct type.
+ ///
+ protected TObjectResult ObjectResultSubject => (TObjectResult)Subject;
+
+ #endregion
+
+ #region Public Methods
+ ///
+ /// Asserts the value is of the expected type.
+ ///
+ /// The expected type.
+ /// The typed value.
+ public TValue ValueAs()
+ {
+ var value = ObjectResultSubject.Value;
+
+ if (value == null)
+ Execute.Assertion
+ .WithDefaultIdentifier($"{Identifier}.Value")
+ .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
+
+ Execute.Assertion
+ .ForCondition(value is TValue)
+ .WithDefaultIdentifier($"{Identifier}.Value")
+ .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
+
+ return (TValue)value;
+ }
+
+ ///
+ /// Asserts that the contains at least one item that matches the predicate.
+ ///
+ /// A predicate to match the items in the against.
+ ///
+ /// A formatted phrase as is supported by explaining why the assertion
+ /// is needed. If the phrase does not start with the word because, it is prepended automatically.
+ ///
+ ///
+ /// Zero or more objects to format using the placeholders in .
+ ///
+ public TObjectResultAssertion ContainsFormatter(Expression> expectation, string reason = "", params object[] reasonArgs)
+ {
+ if (expectation is null)
+ throw new ArgumentNullException(nameof(expectation));
+
+ var formatters = ObjectResultSubject.Formatters;
+
+ if (formatters is null)
+ {
+ Execute.Assertion
+ .BecauseOf(reason, reasonArgs)
+ .WithDefaultIdentifier(Identifier + ".Formatters")
+ .FailWith("Expected {context} to contain {0}{reason} but found {1}.", expectation.Body, formatters);
+ }
+
+ var func = expectation.Compile();
+
+ Execute.Assertion
+ .ForCondition(formatters.Any(func))
+ .WithDefaultIdentifier(Identifier+ ".Formatters")
+ .BecauseOf(reason, reasonArgs)
+ .FailWith("Expected {context} {0} to have an item matching {1}{reason}.", formatters, expectation.Body);
+
+ return (TObjectResultAssertion)this;
+ }
+
+ ///
+ /// Asserts that the contains the specified content type.
+ ///
+ /// The expectation content type.
+ ///
+ /// A formatted phrase as is supported by explaining why the assertion
+ /// is needed. If the phrase does not start with the word because, it is prepended automatically.
+ ///
+ ///
+ /// Zero or more objects to format using the placeholders in .
+ ///
+ public TObjectResultAssertion WithContentType(string expected, string reason = "", params object[] reasonArgs)
+ {
+ var contentTypes = ObjectResultSubject.ContentTypes;
+
+ if (contentTypes is null)
+ {
+ Execute.Assertion
+ .BecauseOf(reason, reasonArgs)
+ .WithDefaultIdentifier(Identifier + ".ContentTypes")
+ .FailWith("Expected {context} to contain {0}{reason} but found {1}.", expected, contentTypes);
+ }
+
+ Execute.Assertion
+ .ForCondition(contentTypes.Contains(expected))
+ .WithDefaultIdentifier(Identifier + ".ContentTypes")
+ .BecauseOf(reason, reasonArgs)
+ .FailWith("Expected {context} {0} to contain {1}{reason}.", contentTypes, expected);
+
+ return (TObjectResultAssertion)this;
+ }
+
+ ///
+ /// Asserts that the is the expected declared type.
+ ///
+ /// The expected declared type.
+ ///
+ /// A formatted phrase as is supported by explaining why the assertion
+ /// is needed. If the phrase does not start with the word because, it is prepended automatically.
+ ///
+ ///
+ /// Zero or more objects to format using the placeholders in .
+ ///
+ public TObjectResultAssertion WithDeclaredType(Type expectedDeclaredType, string reason = "", params object[] reasonArgs)
+ {
+ var actual = ObjectResultSubject.DeclaredType;
+
+ Execute.Assertion
+ .ForCondition(expectedDeclaredType == actual)
+ .WithDefaultIdentifier(Identifier + ".DeclaredType")
+ .BecauseOf(reason, reasonArgs)
+ .FailWith(FailureMessages.CommonTypeFailMessage, expectedDeclaredType, actual);
+
+ return (TObjectResultAssertion)this;
+ }
+
+
+ ///
+ /// Asserts that the is the expected status code.
+ ///
+ /// The expected status code.
+ ///
+ /// A formatted phrase as is supported by explaining why the assertion
+ /// is needed. If the phrase does not start with the word because, it is prepended automatically.
+ ///
+ ///
+ /// Zero or more objects to format using the placeholders in .
+ ///
+ public TObjectResultAssertion WithStatusCode(int? expectedStatusCode, string reason = "", params object[] reasonArgs)
+ {
+ var actual = ObjectResultSubject.StatusCode;
+
+ Execute.Assertion
+ .ForCondition(expectedStatusCode == actual)
+ .WithDefaultIdentifier(Identifier + ".StatusCode")
+ .BecauseOf(reason, reasonArgs)
+ .FailWith(FailureMessages.CommonFailMessage, expectedStatusCode, actual);
+
+ return (TObjectResultAssertion)this;
+ }
+ #endregion
+
+ }
+}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/OkObjectResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/OkObjectResultAssertions.cs
index e19de8c..5568775 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/OkObjectResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/OkObjectResultAssertions.cs
@@ -1,7 +1,5 @@
-using System.Diagnostics;
-using FluentAssertions.Execution;
-using FluentAssertions.Primitives;
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
+using System.Diagnostics;
namespace FluentAssertions.AspNetCore.Mvc
{
@@ -9,7 +7,7 @@ namespace FluentAssertions.AspNetCore.Mvc
/// Contains a number of methods to assert that a is in the expected state.
///
[DebuggerNonUserCode]
- public class OkObjectResultAssertions : ObjectAssertions
+ public class OkObjectResultAssertions : ObjectResultAssertionsBase
{
#region Public Constructors
@@ -22,42 +20,5 @@ public OkObjectResultAssertions(OkObjectResult subject) : base(subject)
}
#endregion
-
- #region Public Properties
- ///
- /// The value on the OkObjectResult
- ///
- public object Value => OkObjectResultSubject.Value;
-
- #endregion
-
- #region Private Properties
- private OkObjectResult OkObjectResultSubject => (OkObjectResult)Subject;
-
- #endregion
-
- #region Public Methods
- ///
- /// Asserts the value is of the expected type.
- ///
- /// The expected type.
- /// The typed value.
- public TValue ValueAs()
- {
- var value = OkObjectResultSubject.Value;
-
- if (value == null)
- Execute.Assertion
- .WithDefaultIdentifier("OkObjectResult.Value")
- .FailWith(FailureMessages.CommonNullWasSuppliedFailMessage, typeof(TValue));
-
- Execute.Assertion
- .ForCondition(value is TValue)
- .WithDefaultIdentifier("OkObjectResult.Value")
- .FailWith(FailureMessages.CommonTypeFailMessage, typeof(TValue), value.GetType());
-
- return (TValue)value;
- }
- #endregion
}
}
diff --git a/src/FluentAssertions.AspNetCore.Mvc/SignInResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/SignInResultAssertions.cs
index 26e233a..4784765 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/SignInResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/SignInResultAssertions.cs
@@ -28,14 +28,49 @@ public SignInResultAssertions(object subject) : base(subject)
#endregion
#region Public Properties
+ ///
+ /// The authentication properties on the SignInResult.
+ ///
public AuthenticationProperties AuthenticationProperties => SignInResultSubject.Properties;
+
+ ///
+ /// The items value in the authentication properties on the SignInResult.
+ ///
public IDictionary Items => SignInResultSubject.Properties?.Items;
+
+ ///
+ /// The is persistent value in the authentication properties on the SignInResult.
+ ///
public bool IsPersistent => SignInResultSubject.Properties?.IsPersistent ?? false;
+
+ ///
+ /// The redirect uri value in the authentication properties on the SignInResult.
+ ///
public string RedirectUri => SignInResultSubject.Properties?.RedirectUri;
+
+ ///
+ /// The issued utc value in the authentication properties on the SignInResult.
+ ///
public DateTimeOffset? IssuedUtc => SignInResultSubject.Properties?.IssuedUtc;
+
+ ///
+ /// The expires utc value in the authentication properties on the SignInResult.
+ ///
public DateTimeOffset? ExpiresUtc => SignInResultSubject.Properties?.ExpiresUtc;
+
+ ///
+ /// The allow refresh value in the authentication properties on the SignInResult.
+ ///
public bool? AllowRefresh => SignInResultSubject.Properties?.AllowRefresh;
+
+ ///
+ /// The authentication scheme value on the SignInResult.
+ ///
public string AuthenticationScheme => SignInResultSubject.AuthenticationScheme;
+
+ ///
+ /// The claims principal value on the SignInResult.
+ ///
public ClaimsPrincipal Principal => SignInResultSubject.Principal;
#endregion
diff --git a/src/FluentAssertions.AspNetCore.Mvc/SignOutResultAssertions.cs b/src/FluentAssertions.AspNetCore.Mvc/SignOutResultAssertions.cs
index dbc6ca0..14a45f1 100644
--- a/src/FluentAssertions.AspNetCore.Mvc/SignOutResultAssertions.cs
+++ b/src/FluentAssertions.AspNetCore.Mvc/SignOutResultAssertions.cs
@@ -28,13 +28,44 @@ public SignOutResultAssertions(object subject) : base(subject)
#endregion
#region Public Properties
+ ///
+ /// The authentication properties on the SignOutResult.
+ ///
public AuthenticationProperties AuthenticationProperties => SignOutResultSubject.Properties;
+
+ ///
+ /// The items value in the authentication properties on the SignOutResult.
+ ///
public IDictionary Items => SignOutResultSubject.Properties?.Items;
+
+ ///
+ /// The is persistent value in the authentication properties on the SignOutResult.
+ ///
public bool IsPersistent => SignOutResultSubject.Properties?.IsPersistent ?? false;
+
+ ///
+ /// The redirect uri value in the authentication properties on the SignOutResult.
+ ///
public string RedirectUri => SignOutResultSubject.Properties?.RedirectUri;
+
+ ///
+ /// The issued utc value in the authentication properties on the SignOutResult.
+ ///
public DateTimeOffset? IssuedUtc => SignOutResultSubject.Properties?.IssuedUtc;
+
+ ///
+ /// The expires utc value in the authentication properties on the SignOutResult.
+ ///
public DateTimeOffset? ExpiresUtc => SignOutResultSubject.Properties?.ExpiresUtc;
+
+ ///
+ /// The allow refresh value in the authentication properties on the SignOutResult.
+ ///
public bool? AllowRefresh => SignOutResultSubject.Properties?.AllowRefresh;
+
+ ///
+ /// The authentication schemes value on the SignOutResult.
+ ///
public IList AuthenticationSchemes => SignOutResultSubject.AuthenticationSchemes;
#endregion
diff --git a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtActionResultAssertions_Tests.cs b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtActionResultAssertions_Tests.cs
index 8778fb9..9ed392f 100644
--- a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtActionResultAssertions_Tests.cs
+++ b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtActionResultAssertions_Tests.cs
@@ -1,6 +1,6 @@
-using System;
-using FluentAssertions.Mvc.Tests.Helpers;
+using FluentAssertions.Mvc.Tests.Helpers;
using Microsoft.AspNetCore.Mvc;
+using System;
using Xunit;
namespace FluentAssertions.AspNetCore.Mvc.Tests
diff --git a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtRouteResultAssertions_Tests.cs b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtRouteResultAssertions_Tests.cs
index 34d520f..137e067 100644
--- a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtRouteResultAssertions_Tests.cs
+++ b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedAtRouteResultAssertions_Tests.cs
@@ -1,11 +1,11 @@
-using System;
-using FluentAssertions.Mvc.Tests.Helpers;
+using FluentAssertions.Mvc.Tests.Helpers;
using Microsoft.AspNetCore.Mvc;
+using System;
using Xunit;
namespace FluentAssertions.AspNetCore.Mvc.Tests
{
-
+
public class AcceptedAtRouteResultAssertions_Tests
{
public const string Reason = FailureMessageHelper.Reason;
diff --git a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedResultAssertions_Tests.cs b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedResultAssertions_Tests.cs
index ebaf4c3..22d22b6 100644
--- a/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedResultAssertions_Tests.cs
+++ b/tests/FluentAssertions.AspNetCore.Mvc.Tests/AcceptedResultAssertions_Tests.cs
@@ -1,6 +1,6 @@
-using System;
-using FluentAssertions.Mvc.Tests.Helpers;
+using FluentAssertions.Mvc.Tests.Helpers;
using Microsoft.AspNetCore.Mvc;
+using System;
using Xunit;
namespace FluentAssertions.AspNetCore.Mvc.Tests
@@ -38,7 +38,7 @@ public void ValueAs_GivenWrongType_ShouldFail()
{
var result = new TestController().Accepted(TestUri, TestValue);
var failureMessage = FailureMessageHelper.ExpectedContextTypeXButFoundY(
- "AcceptedResultAssertions.Value", typeof(int), typeof(string));
+ "AcceptedResult.Value", typeof(int), typeof(string));
Action a = () => result.Should().BeAcceptedResult().ValueAs().Should().Be(2);
@@ -50,7 +50,7 @@ public void ValueAs_Null_ShouldFail()
{
ActionResult result = new AcceptedResult(TestUri, null);
var failureMessage = FailureMessageHelper.ExpectedContextTypeXButFoundNull(
- "AcceptedResultAssertions.Value", typeof(object));
+ "AcceptedResult.Value", typeof(object));
Action a = () => result.Should().BeAcceptedResult().ValueAs