Set the name(not the description) as the Title of the Result (#4745)

* Added tests to verify that the name is always set as the title and never the description

* removed AppType as an argument

* refactored code

* added comments

* localized strings

* removed empty constructor

* made setsubtitle private

* removed the mock Win32 class used for unit testing

* removed the UWP tests
This commit is contained in:
Alekhya
2020-07-07 15:00:17 -07:00
committed by GitHub
parent 8d72bc0ea4
commit a314106b7e
11 changed files with 46 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ using System.IO;
namespace Wox.Test.Plugins
{
[TestFixture]
public class ProgramPluginTest
public class Win32Tests
{
Win32 notepad_appdata = new Win32
{
@@ -138,6 +138,7 @@ namespace Wox.Test.Plugins
Win32 cmder_run_command = new Win32
{
Name = "Cmder",
Description = "Cmder: Lovely Console Emulator",
ExecutableName = "Cmder.exe",
FullPath = "c:\\tools\\cmder\\cmder.exe",
LnkResolvedPath = null,
@@ -333,5 +334,21 @@ namespace Wox.Test.Plugins
// the query matches the name (cmd) and is therefore not filtered (case-insensitive)
Assert.IsTrue(cmd_run_command.QueryEqualsNameForRunCommands(query));
}
[Test]
public void Win32Apps_ShouldSetNameAsTitle_WhileCreatingResult()
{
// Arrange
var mock = new Mock<IPublicAPI>();
mock.Setup(x => x.GetTranslation(It.IsAny<string>())).Returns(It.IsAny<string>());
StringMatcher.Instance = new StringMatcher();
// Act
var result = cmder_run_command.Result("cmder", mock.Object);
// Assert
Assert.IsTrue(result.Title.Equals(cmder_run_command.Name));
Assert.IsFalse(result.Title.Equals(cmder_run_command.Description));
}
}
}