Files
PowerToys/src/modules/launcher/Plugins/Microsoft.Plugin.Sys.UnitTests/ImageTests.cs
Benjamin Hooper 9757a4574f [PT Run] Sys Plugin Port from Wox.Plugins.Sys (#8062)
* Initial Port of Wox.Plugin.Sys

* Add Unit Tests for Microsoft.Plugin.Sys

* Modified Microsoft.Plugin.Sys.UnitTests Properties

* Microsoft.Plugin.Sys x64 Launch

* Fix Styling for Microsoft.Plugin.Sys.UnitTests

* Fixed Misspelling

* Remove Any CPU from Configuration Manager

* Removed Old Icons and Added New Images

* Updated Titles for Localization and Added & Updated Light/Dark Theme Icons

* Added Light/Dark Icon Theme Unit Tests

* Updated QueryTest Expected Results for Microsoft.Plugin.Sys.UnitTests

* Added Spell-Check Expects for Microsoft.Plugin.Sys

* Updated Spell-Check Expects for Microsoft.Plugin.Sys

* Corrected Format in Microsoft.Plugin.Sys

* Corrected Descriptions and Added Comments for Localization

* Added StyleCop and Version Props

* Corrected Format of Microsoft.Plugin.Sys.Main

* Updated Unit Tests for Microsoft.Plugin.Sys

* Updated Spell-Check Expects for Microsoft.Plugin.Sys

* fixing build issue

Co-authored-by: Clint Rutkas <clint@rutkas.com>
2020-11-26 10:35:48 +01:00

68 lines
2.4 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Linq;
using System.Text;
using Mono.Collections.Generic;
using Moq;
using NUnit.Framework;
using Wox.Infrastructure;
using Wox.Plugin;
namespace Microsoft.Plugin.Sys.UnitTests
{
public class ImageTests
{
[SetUp]
public void Setup()
{
StringMatcher.Instance = new StringMatcher();
}
[TestCase("shutdown", "Images\\shutdown.dark.png")]
[TestCase("restart", "Images\\restart.dark.png")]
[TestCase("sign out", "Images\\logoff.dark.png")]
[TestCase("lock", "Images\\lock.dark.png")]
[TestCase("sleep", "Images\\sleep.dark.png")]
[TestCase("hibernate", "Images\\sleep.dark.png")]
[TestCase("empty recycle", "Images\\recyclebin.dark.png")]
public void IconThemeDarkTest(string typedString, string expectedResult)
{
// Setup
Mock<Main> main = new Mock<Main>();
main.Object.IconTheme = "dark";
string[] terms = { typedString };
Query expectedQuery = new Query(typedString, typedString, new ReadOnlyCollection<string>(terms), string.Empty);
// Act
var result = main.Object.Query(expectedQuery).FirstOrDefault().IcoPath;
// Assert
Assert.AreEqual(expectedResult, result);
}
[TestCase("shutdown", "Images\\shutdown.light.png")]
[TestCase("restart", "Images\\restart.light.png")]
[TestCase("sign out", "Images\\logoff.light.png")]
[TestCase("lock", "Images\\lock.light.png")]
[TestCase("sleep", "Images\\sleep.light.png")]
[TestCase("hibernate", "Images\\sleep.light.png")]
[TestCase("empty recycle", "Images\\recyclebin.light.png")]
public void IconThemeLightTest(string typedString, string expectedResult)
{
// Setup
Mock<Main> main = new Mock<Main>();
main.Object.IconTheme = "light";
string[] terms = { typedString };
Query expectedQuery = new Query(typedString, typedString, new ReadOnlyCollection<string>(terms), string.Empty);
// Act
var result = main.Object.Query(expectedQuery).FirstOrDefault().IcoPath;
// Assert
Assert.AreEqual(expectedResult, result);
}
}
}