diff --git a/src/common/UITestAutomation/Session.cs b/src/common/UITestAutomation/Session.cs index ef0a6fff3f..50dad00596 100644 --- a/src/common/UITestAutomation/Session.cs +++ b/src/common/UITestAutomation/Session.cs @@ -44,7 +44,7 @@ namespace Microsoft.PowerToys.UITest // leverage findAll to filter out mismatched elements var collection = this.FindAll(by, timeoutMS); - Assert.IsTrue(collection.Count > 0, $"Element not found using selector: {by}"); + Assert.AreNotEqual(0, collection.Count, $"Element not found using selector: {by}"); return collection[0]; } diff --git a/src/modules/Hosts/Hosts.UITests/HostModuleTests.cs b/src/modules/Hosts/Hosts.UITests/HostModuleTests.cs index c50bbe988e..e9af64d9be 100644 --- a/src/modules/Hosts/Hosts.UITests/HostModuleTests.cs +++ b/src/modules/Hosts/Hosts.UITests/HostModuleTests.cs @@ -125,8 +125,9 @@ namespace Hosts.UITests // Add new URL override and a warning tip should be shown this.AddEntry("192.168.0.1", "localhost", true); - Assert.IsTrue( - this.FindAll("The hosts file cannot be saved because the program isn't running as administrator.").Count == 1, + Assert.AreEqual( + 1, + this.FindAll("The hosts file cannot be saved because the program isn't running as administrator.").Count, "Should display host-file saving error if not run as administrator"); }