Skip to content

Commit

Permalink
#8 Add support for .NET 8 + .NET 6
Browse files Browse the repository at this point in the history
Closes #8
Closes #6
  • Loading branch information
sguldmund committed Jan 13, 2024
1 parent 7cb5636 commit ebcb56f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions test/Pose.Tests/IL/MethodRewriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateTime>));
var func = dynamicMethod.CreateDelegate(typeof(Func<Exception, string>));

// Assert
func.DynamicInvoke().As<DateTime>().Should().BeCloseTo(DateTime.UtcNow, TimeSpan.FromSeconds(10));
var exception = new Exception();
func.DynamicInvoke(exception).As<string>().Should().BeEquivalentTo(exception.Message);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion test/Pose.Tests/Pose.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;netcoreapp3.0;net47;net48;net8.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;netcoreapp3.0;net47;net48;net6.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit ebcb56f

Please sign in to comment.