Skip to content

Commit 7159079

Browse files
committed
Ported Controllers.Test package (#326)
1 parent 65651d9 commit 7159079

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

src/MyTested.AspNetCore.Mvc.Abstractions/Utilities/Validators/InvocationValidator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public static void CheckForException(Exception exception, string exceptionMessag
3131
}
3232

3333
// ArgumentOutOfRangeException may be thrown because of missing route values
34-
if (exception is ArgumentOutOfRangeException exceptionAsArgumentOutOfRangeException
35-
&& exceptionAsArgumentOutOfRangeException.StackTrace.Contains("Microsoft.AspNetCore.Mvc.Routing"))
34+
if (exception is InvalidOperationException exceptionAsInvalidOperationException
35+
&& exceptionAsInvalidOperationException.Message.Contains("Could not find an IRouter"))
3636
{
3737
throw new InvalidOperationException("Route values are not present in the method call but are needed for successful pass of this test case. Consider calling 'WithRouteData' on the component builder to resolve them from the provided lambda expression or set the HTTP request path by using 'WithHttpRequest'.");
3838
}

src/MyTested.AspNetCore.Mvc.Routing/ComponentBuilderRoutingExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ public static class ComponentBuilderRoutingExtensions
2121
public static TBuilder WithRouteData<TBuilder>(
2222
this IBaseTestBuilderWithComponentBuilder<TBuilder> builder)
2323
where TBuilder : IBaseTestBuilder
24-
{
25-
return builder.WithRouteData(null);
26-
}
24+
=> builder
25+
.WithRouteData(null);
2726

2827
/// <summary>
2928
/// Indicates that route values should be extracted from the provided action call expression adding the given additional values.

test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<AssemblyName>MyTested.AspNetCore.Mvc.Test</AssemblyName>
77
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>

test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3+
using Microsoft.AspNetCore.Mvc.ApplicationParts;
34
using Xunit;
45

6+
[assembly: ApplicationPart("MyTested.AspNetCore.Mvc.Test.Setups")]
7+
58
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Controllers.Attributes.Test")]
69
[assembly: ComVisible(false)]
710

test/MyTested.AspNetCore.Mvc.Controllers.Test/MyTested.AspNetCore.Mvc.Controllers.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<AssemblyName>MyTested.AspNetCore.Mvc.Test</AssemblyName>
77
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>

test/MyTested.AspNetCore.Mvc.Controllers.Test/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3+
using Microsoft.AspNetCore.Mvc.ApplicationParts;
34
using Xunit;
45

6+
[assembly: ApplicationPart("MyTested.AspNetCore.Mvc.Test.Setups")]
7+
58
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Controllers.Test")]
69
[assembly: ComVisible(false)]
710

0 commit comments

Comments
 (0)