Update IsTrue to alternative methods

This commit is contained in:
Xiaofeng Wang (from Dev Box)
2025-03-10 16:50:53 +08:00
parent 6fccdbf9bf
commit b1cbf3b6ba
2 changed files with 4 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ namespace Microsoft.PowerToys.UITest
// leverage findAll to filter out mismatched elements
var collection = this.FindAll<T>(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];
}

View File

@@ -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<TextBlock>("The hosts file cannot be saved because the program isn't running as administrator.").Count == 1,
Assert.AreEqual(
1,
this.FindAll<TextBlock>("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");
}