Add unit tests for UsesCodeSignedAssemblies()
Used in MshSnapinInfo.PSSnapInReader
This commit is contained in:
parent
de2ccdb749
commit
c42ba3bd56
|
@ -1 +1 @@
|
|||
Subproject commit fbfb5a555ae4fa6d465eba59fff6edc281cdd536
|
||||
Subproject commit 3ca3331f4bba19ed57595c173264a267878e0b65
|
|
@ -12,6 +12,7 @@ namespace PSTests
|
|||
PlatformTests.TestIsLinux();
|
||||
PlatformTests.TestHasCom();
|
||||
PlatformTests.TestHasAmsi();
|
||||
PlatformTests.TestUsesCodeSignedAssemblies();
|
||||
|
||||
PSTypeExtensionsTests.TestIsComObject();
|
||||
|
||||
|
@ -20,6 +21,10 @@ namespace PSTests
|
|||
SecuritySupportTests.TestCloseSession();
|
||||
SecuritySupportTests.TestUninitialize();
|
||||
|
||||
MshSnapinInfoTests mshSnapinInfoTests = new MshSnapinInfoTests();
|
||||
mshSnapinInfoTests.TestReadRegistryInfo();
|
||||
mshSnapinInfoTests.TestReadCoreEngineSnapIn();
|
||||
|
||||
Console.WriteLine("Finished running tests");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,5 +20,10 @@ namespace PSTests
|
|||
{
|
||||
Assert.False(Platform.HasAmsi());
|
||||
}
|
||||
|
||||
public static void TestUsesCodeSignedAssemblies()
|
||||
{
|
||||
Assert.False(Platform.UsesCodeSignedAssemblies());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
25
src/ps_test/test_MshSnapinInfo.cs
Normal file
25
src/ps_test/test_MshSnapinInfo.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Xunit;
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace PSTests
|
||||
{
|
||||
// Not static because a test requires non-const variables
|
||||
public class MshSnapinInfoTests
|
||||
{
|
||||
// Test that it does not throw an exception
|
||||
public void TestReadRegistryInfo()
|
||||
{
|
||||
Version someVersion = null;
|
||||
string someString = null;
|
||||
PSSnapInReader.ReadRegistryInfo(out someVersion, out someString, out someString, out someString, out someString, out someVersion);
|
||||
}
|
||||
|
||||
// PublicKeyToken is null on Linux
|
||||
public void TestReadCoreEngineSnapIn()
|
||||
{
|
||||
PSSnapInInfo pSSnapInInfo = PSSnapInReader.ReadCoreEngineSnapIn();
|
||||
Assert.Contains("PublicKeyToken=null", pSSnapInInfo.AssemblyName);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue