Skip to content

Commit d18efc1

Browse files
committed
Added extension and ctor for IActionResult
.Net Core brings the IActionResult interface, I've added an extension and a constructor for the IActionResult interface to make the Assertions compatible.
1 parent c44131d commit d18efc1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/FluentAssertions.Mvc.Shared/ActionResultAssertions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ public ActionResultAssertions (ActionResult subject) : base(subject)
2929
Subject = subject;
3030
}
3131

32+
#if NETSTANDARD1_6
33+
public ActionResultAssertions (IActionResult subject): base(subject)
34+
{
35+
Subject = subject;
36+
}
37+
#endif
38+
3239
/// <summary>
3340
/// Asserts that the subject is a <see cref="ContentResult"/>.
3441
/// </summary>

src/FluentAssertions.Mvc.Shared/AssertionsExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public static ActionResultAssertions Should (this ActionResult actual)
2727
return new ActionResultAssertions (actual);
2828
}
2929

30+
#if NETSTANDARD1_6
31+
/// <summary>
32+
/// Returns an <see cref="ActionResultAssertions"/> object that can be used to assert the
33+
/// current <see cref="IActionResult"/>.
34+
/// </summary>
35+
public static ActionResultAssertions Should (this IActionResult actual)
36+
{
37+
return new ActionResultAssertions (actual);
38+
}
39+
#endif
40+
3041
/// <summary>
3142
/// Returns an <see cref="RouteDataAssertions"/> object that can be used to assert the
3243
/// current <see cref="RouteData"/>.

0 commit comments

Comments
 (0)