Skip to content

Commit 54ac1c3

Browse files
committed
#290 Added overloads for Calling method
1 parent 24f6a87 commit 54ac1c3

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/MyTested.AspNetCore.Mvc.Controllers/MyController.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
using System;
44
using System.Linq.Expressions;
5+
using System.Threading.Tasks;
56
using Builders.Contracts.Actions;
67
using Builders.Contracts.Controllers;
78
using Builders.Controllers;
@@ -73,6 +74,35 @@ public static IControllerBuilder<TController> Instance(Func<TController> constru
7374
/// <param name="actionCall">Method call expression indicating invoked action.</param>
7475
/// <returns>Test builder of <see cref="IActionResultTestBuilder{TActionResult}"/> type.</returns>
7576
public new static IActionResultTestBuilder<TActionResult> Calling<TActionResult>(Expression<Func<TController, TActionResult>> actionCall)
76-
=> Instance().Calling(actionCall);
77+
=> Instance()
78+
.Calling(actionCall);
79+
80+
/// <summary>
81+
/// Indicates which action should be invoked and tested.
82+
/// </summary>
83+
/// <typeparam name="TActionResult">Type of result from action.</typeparam>
84+
/// <param name="actionCall">Method call expression indicating invoked asynchronous action.</param>
85+
/// <returns>Test builder of <see cref="IActionResultTestBuilder{TActionResult}"/> type.</returns>
86+
public new static IActionResultTestBuilder<TActionResult> Calling<TActionResult>(Expression<Func<TController, Task<TActionResult>>> actionCall)
87+
=> Instance()
88+
.Calling(actionCall);
89+
90+
/// <summary>
91+
/// Indicates which action should be invoked and tested.
92+
/// </summary>
93+
/// <param name="actionCall">Method call expression indicating invoked void action.</param>
94+
/// <returns>Test builder of <see cref="IActionResultTestBuilder{TActionResult}"/> type.</returns>
95+
public new static IVoidActionResultTestBuilder Calling(Expression<Action<TController>> actionCall)
96+
=> Instance()
97+
.Calling(actionCall);
98+
99+
/// <summary>
100+
/// Indicates which action should be invoked and tested.
101+
/// </summary>
102+
/// <param name="actionCall">Method call expression indicating invoked asynchronous void action.</param>
103+
/// <returns>Test builder of <see cref="IActionResultTestBuilder{TActionResult}"/> type.</returns>
104+
public new static IVoidActionResultTestBuilder Calling(Expression<Func<TController, Task>> actionCall)
105+
=> Instance()
106+
.Calling(actionCall);
77107
}
78108
}

0 commit comments

Comments
 (0)