Skip to content

Commit 677e03b

Browse files
committed
Added .Passing methods to the .ActionResult<TResult> assertion chain (#359)
1 parent 93399ac commit 677e03b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/MyTested.AspNetCore.Mvc.Controllers/Builders/Actions/ShouldReturn/ShouldReturnActionResultTestBuilder.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace MyTested.AspNetCore.Mvc.Builders.Actions.ShouldReturn
22
{
33
using System;
4+
using ActionResults.ActionResult;
45
using And;
6+
using Contracts.ActionResults.ActionResult;
57
using Contracts.Actions;
68
using Contracts.And;
79
using Internal.TestContexts;
@@ -46,13 +48,15 @@ public ShouldReturnActionResultTestBuilder(ControllerTestContext testContext)
4648
return new AndTestBuilder(this.TestContext);
4749
}
4850

51+
/// <inheritdoc />
4952
public new IAndTestBuilder ActionResult<TResult>()
5053
{
5154
this.ValidateActionResult<TResult>();
5255

5356
return new AndTestBuilder(this.TestContext);
5457
}
5558

59+
/// <inheritdoc />
5660
public new IAndTestBuilder ActionResult<TResult>(
5761
Action<IShouldReturnTestBuilder<TActionResult>> actionResultTestBuilder)
5862
{
@@ -63,6 +67,16 @@ public ShouldReturnActionResultTestBuilder(ControllerTestContext testContext)
6367
return new AndTestBuilder(this.TestContext);
6468
}
6569

70+
/// <inheritdoc />
71+
public new IAndTestBuilder ActionResult<TResult>(Action<IActionResultOfTTestBuilder<TResult>> actionResultTestBuilder)
72+
{
73+
this.ValidateActionResult<TResult>();
74+
75+
actionResultTestBuilder?.Invoke(new ActionResultOfTTestBuilder<TResult>(this.TestContext));
76+
77+
return new AndTestBuilder(this.TestContext);
78+
}
79+
6680
private void ValidateActionResults()
6781
=> InvocationResultValidator.ValidateInvocationResultTypes(
6882
this.TestContext,

0 commit comments

Comments
 (0)