mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[PT Run] System commands plugin: Update dev docs and UnitTests (#15832)
* update UnitTests * dev docs * fix plugin name * fix spelling * fix path * improvement * fix table
This commit is contained in:
@@ -27,11 +27,13 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("sleep", "Images\\sleep.dark.png")]
|
||||
[DataRow("hibernate", "Images\\sleep.dark.png")]
|
||||
[DataRow("empty recycle", "Images\\recyclebin.dark.png")]
|
||||
[DataRow("uefi firmware settings", "Images\\firmwareSettings.dark.png")]
|
||||
public void IconThemeDarkTest(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new Mock<Main>();
|
||||
main.Object.IconTheme = "dark";
|
||||
main.Object.IsBootedInUefiMode = true; // Set to true that we can test, regardless of the environment we run on.
|
||||
Query expectedQuery = new Query(typedString);
|
||||
|
||||
// Act
|
||||
@@ -49,11 +51,13 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("sleep", "Images\\sleep.light.png")]
|
||||
[DataRow("hibernate", "Images\\sleep.light.png")]
|
||||
[DataRow("empty recycle", "Images\\recyclebin.light.png")]
|
||||
[DataRow("uefi firmware settings", "Images\\firmwareSettings.light.png")]
|
||||
public void IconThemeLightTest(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new Mock<Main>();
|
||||
main.Object.IconTheme = "light";
|
||||
main.Object.IsBootedInUefiMode = true; // Set to true that we can test, regardless of the environment we run on.
|
||||
Query expectedQuery = new Query(typedString);
|
||||
|
||||
// Act
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("sleep", "Put computer to sleep")]
|
||||
[DataRow("hibernate", "Hibernate computer")]
|
||||
[DataRow("empty recycle", "Empty Recycle Bin")]
|
||||
public void QueryResults(string typedString, string expectedResult)
|
||||
public void EnvironmentIndependentQueryResults(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new Mock<Main>();
|
||||
@@ -39,5 +39,35 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UefiCommandIsAvailableOnUefiSystems()
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new Mock<Main>();
|
||||
main.Object.IsBootedInUefiMode = true; // Simulate system with UEFI.
|
||||
Query expectedQuery = new Query("uefi firm");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault().SubTitle;
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("Reboot computer into UEFI Firmware Settings (Requires administrative permissions.)", result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UefiCommandIsNotAvailableOnSystemsWithoutUefi()
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new Mock<Main>();
|
||||
main.Object.IsBootedInUefiMode = false; // Simulate system without UEFI.
|
||||
Query expectedQuery = new Query("uefi firm");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault();
|
||||
|
||||
// Assert
|
||||
Assert.IsNull(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user