diff --git a/test/Pose.Tests/IL/MethodRewriterTests.cs b/test/Pose.Tests/IL/MethodRewriterTests.cs index 6b21268..130d5e9 100644 --- a/test/Pose.Tests/IL/MethodRewriterTests.cs +++ b/test/Pose.Tests/IL/MethodRewriterTests.cs @@ -35,15 +35,16 @@ public void Can_rewrite_static_method() public void Cannot_rewrite_method_in_CoreLib() { // Arrange - var methodInfo = typeof(DateTime).GetMethod("get_UtcNow"); + var methodInfo = typeof(Exception).GetMethod("get_Message"); var methodRewriter = MethodRewriter.CreateRewriter(methodInfo, false); // Act var dynamicMethod = methodRewriter.Rewrite() as DynamicMethod; - var func = dynamicMethod.CreateDelegate(typeof(Func)); + var func = dynamicMethod.CreateDelegate(typeof(Func)); // Assert - func.DynamicInvoke().As().Should().BeCloseTo(DateTime.UtcNow, TimeSpan.FromSeconds(10)); + var exception = new Exception(); + func.DynamicInvoke(exception).As().Should().BeEquivalentTo(exception.Message); } [Fact] diff --git a/test/Pose.Tests/Pose.Tests.csproj b/test/Pose.Tests/Pose.Tests.csproj index f937604..44e82ea 100644 --- a/test/Pose.Tests/Pose.Tests.csproj +++ b/test/Pose.Tests/Pose.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0;netcoreapp3.0;net47;net48;net8.0 + netcoreapp2.0;netcoreapp3.0;net47;net48;net6.0;net8.0 false