Skip to content

Commit 2a26457

Browse files
committed
Max Parallel Threads are set to 2 (#169)
1 parent 27dc54f commit 2a26457

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

samples/MusicStore/MusicStore.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Runtime.InteropServices;
33
using Xunit;
44

5+
[assembly: CollectionBehavior(MaxParallelThreads = 2)]
6+
57
// General Information about an assembly is controlled through the following
68
// set of attributes. Change these attribute values to modify the information
79
// associated with an assembly.

src/MyTested.AspNetCore.Mvc.Core/Builders/Controllers/ControllerActionCallBuilder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public IActionResultTestBuilder<TActionResult> Calling<TActionResult>(Expression
4343
{
4444
var actionInfo = this.GetAndValidateActionResult(actionCall);
4545
var actionResult = default(TActionResult);
46-
actionInfo.ActionResult.ConfigureAwait(false);
4746

4847
try
4948
{
@@ -87,7 +86,6 @@ public IVoidActionResultTestBuilder Calling(Expression<Action<TController>> acti
8786
public IVoidActionResultTestBuilder Calling(Expression<Func<TController, Task>> actionCall)
8887
{
8988
var actionInfo = this.GetAndValidateActionResult(actionCall);
90-
actionInfo.ActionResult.ConfigureAwait(false);
9189

9290
try
9391
{

src/MyTested.AspNetCore.Mvc.Core/Internal/Formatters/FormattersHelper.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ public static TModel ReadFromStream<TModel>(Stream stream, string contentType, E
5353

5454
return formatter;
5555
});
56-
57-
var task = inputFormatter.ReadAsync(inputFormatterContext);
58-
task.ConfigureAwait(false);
59-
60-
var result = AsyncHelper.RunSync(() => task).Model;
56+
57+
var result = AsyncHelper.RunSync(() => inputFormatter.ReadAsync(inputFormatterContext)).Model;
6158

6259
try
6360
{
@@ -93,11 +90,8 @@ public static Stream WriteToStream<TBody>(TBody value, string contentType, Encod
9390

9491
return formatter;
9592
});
96-
97-
var task = outputFormatter.WriteAsync(outputFormatterCanWriteContext);
98-
task.ConfigureAwait(false);
99-
100-
AsyncHelper.RunSync(() => task);
93+
94+
AsyncHelper.RunSync(() => outputFormatter.WriteAsync(outputFormatterCanWriteContext));
10195

10296
// copy memory stream because formatters close the original one
10397
return new MemoryStream(((MemoryStream)httpContext.Response.Body).ToArray());

src/MyTested.AspNetCore.Mvc.Core/Internal/Routes/InternalRouteResolver.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ public static ResolvedRouteContext Resolve(IServiceProvider services, IRouter ro
8383

8484
try
8585
{
86-
var task = modelBindingActionInvoker.InvokeAsync();
87-
task.ConfigureAwait(false);
88-
AsyncHelper.RunSync(() => task);
86+
AsyncHelper.RunSync(() => modelBindingActionInvoker.InvokeAsync());
8987
}
9088
catch (Exception ex)
9189
{
@@ -118,11 +116,8 @@ public static RouteData ResolveRouteData(IRouter router, RouteContext routeConte
118116
{
119117
return null;
120118
}
121-
122-
var task = router.RouteAsync(routeContext);
123-
task.ConfigureAwait(false);
124-
125-
AsyncHelper.RunSync(() => task);
119+
120+
AsyncHelper.RunSync(() => router.RouteAsync(routeContext));
126121

127122
var routeData = routeContext.RouteData;
128123
routeContext.HttpContext.SetRouteData(routeData);

0 commit comments

Comments
 (0)