From 01816e21d11b11811c2f25d98bd87f562a569bb7 Mon Sep 17 00:00:00 2001 From: David Naylor Date: Tue, 9 Aug 2022 18:37:42 +0100 Subject: [PATCH] Enable DispatchProxy ByRef In tests for .NET 6 --- test/DivertR.UnitTests/ByRefInTests.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/DivertR.UnitTests/ByRefInTests.cs b/test/DivertR.UnitTests/ByRefInTests.cs index eb0099c9..dd4d1030 100644 --- a/test/DivertR.UnitTests/ByRefInTests.cs +++ b/test/DivertR.UnitTests/ByRefInTests.cs @@ -1,5 +1,4 @@ -using DivertR.DynamicProxy; -using DivertR.UnitTests.Model; +using DivertR.UnitTests.Model; using Shouldly; using Xunit; @@ -7,10 +6,13 @@ namespace DivertR.UnitTests { public class ByRefInTests { - // Due to a known issue DispatchProxy does not currently support in byref parameters +#if NET6_0_OR_GREATER + private static readonly DiverterSettings DiverterSettings = new(); +#else + // Due to a known issue DispatchProxy does not support in byref parameters prior to .NET 6 // https://github.com/dotnet/runtime/issues/47522 - private static readonly DiverterSettings DiverterSettings = new(new DynamicProxyFactory()); - + private static readonly DiverterSettings DiverterSettings = new(proxyFactory: new DynamicProxy.DynamicProxyFactory()); +#endif private readonly IVia _via = new ViaSet(DiverterSettings).Via(); [Fact]