To ensure that the initializer is called before any other code. This is as close to a global init hook as I can find.
36 lines
889 B
C#
36 lines
889 B
C#
using Xunit;
|
|
using System;
|
|
using System.Management.Automation;
|
|
|
|
namespace PSTests
|
|
{
|
|
[Collection("AssemblyLoadContext")]
|
|
public static class SecuritySupportTests
|
|
{
|
|
[Fact]
|
|
public static void TestScanContent()
|
|
{
|
|
Assert.Equal(AmsiUtils.ScanContent("", ""), AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED);
|
|
}
|
|
|
|
[Fact]
|
|
public static void TestCurrentDomain_ProcessExit()
|
|
{
|
|
Assert.Throws<PlatformNotSupportedException>(delegate {
|
|
AmsiUtils.CurrentDomain_ProcessExit(null, EventArgs.Empty);
|
|
});
|
|
}
|
|
|
|
[Fact]
|
|
public static void TestCloseSession()
|
|
{
|
|
AmsiUtils.CloseSession();
|
|
}
|
|
|
|
[Fact]
|
|
public static void TestUninitialize()
|
|
{
|
|
AmsiUtils.Uninitialize();
|
|
}
|
|
}
|
|
}
|