diff --git a/Rebound/Rebound/Pages/ControlPanel/SystemAndSecurity.xaml.cs b/Rebound/Rebound/Pages/ControlPanel/SystemAndSecurity.xaml.cs index 19b9055..0e525e5 100644 --- a/Rebound/Rebound/Pages/ControlPanel/SystemAndSecurity.xaml.cs +++ b/Rebound/Rebound/Pages/ControlPanel/SystemAndSecurity.xaml.cs @@ -31,7 +31,7 @@ public SystemAndSecurity() CheckDefenderStatus(); } - void CheckDefenderStatus() + public void CheckDefenderStatus() { try { @@ -194,7 +194,7 @@ public static int UACStatus() } } - string DecodeProductState(int productState) + public string DecodeProductState(int productState) { // Define the bit masks const int ProductStateMask = 0xF000; diff --git a/Rebound/UninstallationWindow.xaml.cs b/Rebound/UninstallationWindow.xaml.cs index 5cf1ec5..3e0e830 100644 --- a/Rebound/UninstallationWindow.xaml.cs +++ b/Rebound/UninstallationWindow.xaml.cs @@ -22,10 +22,10 @@ public UninstallationWindow() Load(); } - double currentStep = 0; - double totalSteps = 0; - double currentSubstep = 0; - double totalSubsteps = 0; + public double currentStep = 0; + public double totalSteps = 0; + public double currentSubstep = 0; + public double totalSubsteps = 0; public async void Load() { diff --git a/Tests/ControlPanel/SystemAndSecurity.cs b/Tests/ControlPanel/SystemAndSecurity.cs new file mode 100644 index 0000000..2b8f17a --- /dev/null +++ b/Tests/ControlPanel/SystemAndSecurity.cs @@ -0,0 +1,35 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Rebound.Rebound.Pages.ControlPanel; +using System.Linq; +using Windows.ApplicationModel.Core; +using Microsoft.UI.Xaml.Controls; +using System.Management; + +namespace Rebound.Tests.ControlPanel +{ + [TestClass] + public class SystemAndSecurityTests + { + private SystemAndSecurity _systemAndSecurity; + + [TestInitialize] + public void Setup() + { + _systemAndSecurity = new SystemAndSecurity(); + } + + [TestMethod] + public void Test_UACStatus() + { + int status = SystemAndSecurity.UACStatus(); + Assert.IsTrue(status >= -1000 && status <= 3, "UACStatus should return a value between -1000 and 3."); + } + + [TestMethod] + public void Test_DecodeProductState() + { + string state = _systemAndSecurity.DecodeProductState(0x10000); + Assert.AreEqual("B", state, "DecodeProductState should correctly decode the product state."); + } + } +} \ No newline at end of file diff --git a/Tests/Rebound.Tests.csproj b/Tests/Rebound.Tests.csproj index 7f894fb..17e03e3 100644 --- a/Tests/Rebound.Tests.csproj +++ b/Tests/Rebound.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + net8.0-windows10.0.22621.0 latest enable enable @@ -12,4 +12,8 @@ true + + + + diff --git a/Tests/Rebound/UninstallationWindow.cs b/Tests/Rebound/UninstallationWindow.cs new file mode 100644 index 0000000..5db22d4 --- /dev/null +++ b/Tests/Rebound/UninstallationWindow.cs @@ -0,0 +1,39 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Rebound; +using System.Threading.Tasks; + +namespace Rebound.Tests.Rebound +{ + [TestClass] + public class UninstallationWindowTests + { + private UninstallationWindow _uninstallationWindow; + + [TestInitialize] + public void Setup() + { + _uninstallationWindow = new UninstallationWindow(); + } + + [TestMethod] + public async Task Test_UninstallAppPackage() + { + await _uninstallationWindow.UninstallAppPackage("packageFamilyName", "displayAppName", "lnkFile", "lnkDestination", "lnkDisplayName"); + Assert.AreEqual(3, _uninstallationWindow.currentStep, "currentStep should be 3 after UninstallAppPackage is called."); + } + + [TestMethod] + public async Task Test_DeleteShortcut() + { + await _uninstallationWindow.DeleteShortcut("displayAppName", "lnkDestination", "lnkDisplayName"); + Assert.AreEqual(1, _uninstallationWindow.currentStep, "currentStep should be 1 after DeleteShortcut is called."); + } + + [TestMethod] + public async Task Test_ReplaceShortcut() + { + await _uninstallationWindow.ReplaceShortcut("displayAppName", "lnkFile", "lnkDestination", "lnkDisplayName"); + Assert.AreEqual(1, _uninstallationWindow.currentStep, "currentStep should be 1 after ReplaceShortcut is called."); + } + } +} \ No newline at end of file