Skip to content

Commit b8be396

Browse files
committed
Attempt to fix SimulateLoadUnmanagedDll test on *nix.
1 parent 740c32c commit b8be396

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

PSql.Deploy.Tests/Internal/PrivateAssemblyLoadContextTests.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,28 @@ public void Load_Empty()
2626
[Test]
2727
public void LoadUnmanagedDll_Found()
2828
{
29-
PrivateAssemblyLoadContext
30-
.Instance
31-
.SimulateLoadUnmanagedDll("Microsoft.Data.SqlClient.SNI")
32-
.ShouldNotBe(IntPtr.Zero);
29+
if (OperatingSystem.IsWindows())
30+
{
31+
PrivateAssemblyLoadContext
32+
.Instance
33+
.SimulateLoadUnmanagedDll("Microsoft.Data.SqlClient.SNI")
34+
.ShouldNotBe(IntPtr.Zero);
3335

34-
// Exercise caching
35-
PrivateAssemblyLoadContext
36-
.Instance
37-
.SimulateLoadUnmanagedDll("Microsoft.Data.SqlClient.SNI")
38-
.ShouldNotBe(IntPtr.Zero);
36+
// Exercise caching
37+
PrivateAssemblyLoadContext
38+
.Instance
39+
.SimulateLoadUnmanagedDll("Microsoft.Data.SqlClient.SNI")
40+
.ShouldNotBe(IntPtr.Zero);
41+
}
42+
else
43+
{
44+
Should.Throw<BadImageFormatException>(() =>
45+
{
46+
PrivateAssemblyLoadContext
47+
.Instance
48+
.SimulateLoadUnmanagedDll("Microsoft.Data.SqlClient.SNI");
49+
});
50+
}
3951
}
4052

4153
[Test]

0 commit comments

Comments
 (0)