mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[fxcop] Settings UI unit tests (#6987)
* Add FxCop to project * Remove underscores from method names * Add message to obsolete test method * Mark method static * Method renames and remove unused ToRGBHex method * Method renames and replace Count() with the List.Count property * Method renames, rename unused OnSend argument, validate argument for AssertHotkeySettings
This commit is contained in:
@@ -24,6 +24,11 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
|
||||||
|
<Version>3.3.0</Version>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace CommonLibTest
|
|||||||
// https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.
|
// https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.
|
||||||
// Test also fails when the attributes are not initialized i.e they have null values.
|
// Test also fails when the attributes are not initialized i.e they have null values.
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[Obsolete]
|
[ObsoleteAttribute("This test method is obsolete.", true)]
|
||||||
public void ToJsonString_ShouldReturnValidJSONOfModel_WhenSuccessful()
|
public void ToJsonStringShouldReturnValidJSONOfModelWhenSuccessful()
|
||||||
{
|
{
|
||||||
//Mock Disk access
|
//Mock Disk access
|
||||||
string saveContent = string.Empty;
|
string saveContent = string.Empty;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace CommonLibTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Helper_CompareVersions_ShouldBeEqual_WhenSuccessful()
|
public void HelperCompareVersionsShouldBeEqualWhenSuccessful()
|
||||||
{
|
{
|
||||||
TestStringsAreEqual("v0.0.0", "v0.0.0");
|
TestStringsAreEqual("v0.0.0", "v0.0.0");
|
||||||
TestStringsAreEqual("v0.1.1", "v0.1.1");
|
TestStringsAreEqual("v0.1.1", "v0.1.1");
|
||||||
@@ -33,7 +33,7 @@ namespace CommonLibTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Helper_CompareVersions_ShouldBeSmaller_WhenSuccessful()
|
public void HelperCompareVersionsShouldBeSmallerWhenSuccessful()
|
||||||
{
|
{
|
||||||
TestStringIsSmaller("v0.0.0", "v0.0.1");
|
TestStringIsSmaller("v0.0.0", "v0.0.1");
|
||||||
TestStringIsSmaller("v0.0.0", "v0.1.0");
|
TestStringIsSmaller("v0.0.0", "v0.1.0");
|
||||||
@@ -47,28 +47,28 @@ namespace CommonLibTest
|
|||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(FormatException))]
|
[ExpectedException(typeof(FormatException))]
|
||||||
public void Helper_CompareVersions_ShouldThrowBadFormat_WhenNoVersionString()
|
public void HelperCompareVersionsShouldThrowBadFormatWhenNoVersionString()
|
||||||
{
|
{
|
||||||
Helper.CompareVersions("v0.0.1", string.Empty);
|
Helper.CompareVersions("v0.0.1", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(FormatException))]
|
[ExpectedException(typeof(FormatException))]
|
||||||
public void Helper_CompareVersions_ShouldThrowBadFormat_WhenShortVersionString()
|
public void HelperCompareVersionsShouldThrowBadFormatWhenShortVersionString()
|
||||||
{
|
{
|
||||||
Helper.CompareVersions("v0.0.1", "v0.1");
|
Helper.CompareVersions("v0.0.1", "v0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(FormatException))]
|
[ExpectedException(typeof(FormatException))]
|
||||||
public void Helper_CompareVersions_ShouldThrowBadFormat_WhenLongVersionString()
|
public void HelperCompareVersionsShouldThrowBadFormatWhenLongVersionString()
|
||||||
{
|
{
|
||||||
Helper.CompareVersions("v0.0.1", "v0.0.0.1");
|
Helper.CompareVersions("v0.0.1", "v0.0.0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(FormatException))]
|
[ExpectedException(typeof(FormatException))]
|
||||||
public void Helper_CompareVersions_ShouldThrowBadFormat_WhenItIsNotAVersionString()
|
public void HelperCompareVersionsShouldThrowBadFormatWhenItIsNotAVersionString()
|
||||||
{
|
{
|
||||||
Helper.CompareVersions("v0.0.1", "HelloWorld");
|
Helper.CompareVersions("v0.0.1", "HelloWorld");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace CommonLibTest
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class SettingsRepositoryTest
|
public class SettingsRepositoryTest
|
||||||
{
|
{
|
||||||
private Task<SettingsRepository<GeneralSettings>> GetSettingsRepository(ISettingsUtils settingsUtils)
|
private static Task<SettingsRepository<GeneralSettings>> GetSettingsRepository(ISettingsUtils settingsUtils)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace CommonLibTest
|
|||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SaveSettings_SaveSettingsToFile_WhenFilePathExists()
|
public void SaveSettingsSaveSettingsToFileWhenFilePathExists()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -41,7 +41,7 @@ namespace CommonLibTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SaveSettings_ShouldCreateFile_WhenFilePathIsNotFound()
|
public void SaveSettingsShouldCreateFileWhenFilePathIsNotFound()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -59,7 +59,7 @@ namespace CommonLibTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SettingsFolderExists_ShouldReturnFalse_WhenFilePathIsNotFound()
|
public void SettingsFolderExistsShouldReturnFalseWhenFilePathIsNotFound()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ namespace ViewModelTests
|
|||||||
private Mock<ISettingsUtils> mockFancyZonesSettingsUtils;
|
private Mock<ISettingsUtils> mockFancyZonesSettingsUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
||||||
mockFancyZonesSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<FancyZonesSettings>();
|
mockFancyZonesSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<FancyZonesSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsEnabled_ShouldDisableModule_WhenSuccessful()
|
public void IsEnabledShouldDisableModuleWhenSuccessful()
|
||||||
{
|
{
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShiftDrag_ShouldSetValue2False_WhenSuccessful()
|
public void ShiftDragShouldSetValue2FalseWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -69,7 +69,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void OverrideSnapHotkeys_ShouldSetValue2True_WhenSuccessful()
|
public void OverrideSnapHotkeysShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -88,7 +88,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MoveWindowsBasedOnPosition_ShouldSetValue2True_WhenSuccessful()
|
public void MoveWindowsBasedOnPositionShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -107,7 +107,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ZoneSetChangeFlashZones_ShouldSetValue2False_WhenSuccessful()
|
public void ZoneSetChangeFlashZonesShouldSetValue2FalseWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -126,7 +126,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MouseSwitch_ShouldSetValue2True_WhenSuccessful()
|
public void MouseSwitchShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -145,7 +145,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void DisplayChangeMoveWindows_ShouldSetValue2True_WhenSuccessful()
|
public void DisplayChangeMoveWindowsShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -164,7 +164,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ZoneSetChangeMoveWindows_ShouldSetValue2True_WhenSuccessful()
|
public void ZoneSetChangeMoveWindowsShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -183,7 +183,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AppLastZoneMoveWindows_ShouldSetValue2True_WhenSuccessful()
|
public void AppLastZoneMoveWindowsShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -201,7 +201,7 @@ namespace ViewModelTests
|
|||||||
viewModel.AppLastZoneMoveWindows = true;
|
viewModel.AppLastZoneMoveWindows = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenWindowOnActiveMonitor_ShouldSetValue2True_WhenSuccessful()
|
public void OpenWindowOnActiveMonitorShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -220,7 +220,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void RestoreSize_ShouldSetValue2True_WhenSuccessful()
|
public void RestoreSizeShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -239,7 +239,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void UseCursorPosEditorStartupScreen_ShouldSetValue2False_WhenSuccessful()
|
public void UseCursorPosEditorStartupScreenShouldSetValue2FalseWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -258,7 +258,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShowOnAllMonitors_ShouldSetValue2True_WhenSuccessful()
|
public void ShowOnAllMonitorsShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -277,7 +277,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ZoneHighlightColor_ShouldSetColorValue2White_WhenSuccessful()
|
public void ZoneHighlightColorShouldSetColorValue2WhiteWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -296,7 +296,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ZoneBorderColor_ShouldSetColorValue2White_WhenSuccessful()
|
public void ZoneBorderColorShouldSetColorValue2WhiteWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -315,7 +315,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ZoneInActiveColor_ShouldSetColorValue2White_WhenSuccessful()
|
public void ZoneInActiveColorShouldSetColorValue2WhiteWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -334,7 +334,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ExcludedApps_ShouldSetColorValue2White_WhenSuccessful()
|
public void ExcludedAppsShouldSetColorValue2WhiteWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -353,7 +353,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void HighlightOpacity_ShouldSetOpacityValueTo60_WhenSuccessful()
|
public void HighlightOpacityShouldSetOpacityValueTo60WhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -370,10 +370,5 @@ namespace ViewModelTests
|
|||||||
// act
|
// act
|
||||||
viewModel.HighlightOpacity = 60;
|
viewModel.HighlightOpacity = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToRGBHex(Color color)
|
|
||||||
{
|
|
||||||
return "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,18 @@ namespace ViewModelTests
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class General
|
public class General
|
||||||
{
|
{
|
||||||
public const string generalSettings_file_name = "Test\\GenealSettings";
|
public const string generalSettingsFileName = "Test\\GenealSettings";
|
||||||
|
|
||||||
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
|
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsElevated_ShouldUpdateRunasAdminStatusAttrs_WhenSuccessful()
|
public void IsElevatedShouldUpdateRunasAdminStatusAttrsWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
||||||
@@ -44,7 +44,7 @@ namespace ViewModelTests
|
|||||||
SendMockIPCConfigMSG,
|
SendMockIPCConfigMSG,
|
||||||
SendRestartAdminIPCMessage,
|
SendRestartAdminIPCMessage,
|
||||||
SendCheckForUpdatesIPCMessage,
|
SendCheckForUpdatesIPCMessage,
|
||||||
generalSettings_file_name);
|
generalSettingsFileName);
|
||||||
|
|
||||||
Assert.AreEqual(viewModel.RunningAsUserDefaultText, viewModel.RunningAsText);
|
Assert.AreEqual(viewModel.RunningAsUserDefaultText, viewModel.RunningAsText);
|
||||||
Assert.IsFalse(viewModel.IsElevated);
|
Assert.IsFalse(viewModel.IsElevated);
|
||||||
@@ -58,7 +58,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Startup_ShouldEnableRunOnStartUp_WhenSuccessful()
|
public void StartupShouldEnableRunOnStartUpWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -81,7 +81,7 @@ namespace ViewModelTests
|
|||||||
SendMockIPCConfigMSG,
|
SendMockIPCConfigMSG,
|
||||||
SendRestartAdminIPCMessage,
|
SendRestartAdminIPCMessage,
|
||||||
SendCheckForUpdatesIPCMessage,
|
SendCheckForUpdatesIPCMessage,
|
||||||
generalSettings_file_name);
|
generalSettingsFileName);
|
||||||
Assert.IsFalse(viewModel.Startup);
|
Assert.IsFalse(viewModel.Startup);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@@ -89,7 +89,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void RunElevated_ShouldEnableAlwaysRunElevated_WhenSuccessful()
|
public void RunElevatedShouldEnableAlwaysRunElevatedWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -113,7 +113,7 @@ namespace ViewModelTests
|
|||||||
SendMockIPCConfigMSG,
|
SendMockIPCConfigMSG,
|
||||||
SendRestartAdminIPCMessage,
|
SendRestartAdminIPCMessage,
|
||||||
SendCheckForUpdatesIPCMessage,
|
SendCheckForUpdatesIPCMessage,
|
||||||
generalSettings_file_name);
|
generalSettingsFileName);
|
||||||
|
|
||||||
Assert.IsFalse(viewModel.RunElevated);
|
Assert.IsFalse(viewModel.RunElevated);
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsLightThemeRadioButtonChecked_ShouldThemeToLight_WhenSuccessful()
|
public void IsLightThemeRadioButtonCheckedShouldThemeToLightWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
GeneralViewModel viewModel = null;
|
GeneralViewModel viewModel = null;
|
||||||
@@ -146,7 +146,7 @@ namespace ViewModelTests
|
|||||||
SendMockIPCConfigMSG,
|
SendMockIPCConfigMSG,
|
||||||
SendRestartAdminIPCMessage,
|
SendRestartAdminIPCMessage,
|
||||||
SendCheckForUpdatesIPCMessage,
|
SendCheckForUpdatesIPCMessage,
|
||||||
generalSettings_file_name);
|
generalSettingsFileName);
|
||||||
Assert.IsFalse(viewModel.IsLightThemeRadioButtonChecked);
|
Assert.IsFalse(viewModel.IsLightThemeRadioButtonChecked);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@@ -154,7 +154,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsDarkThemeRadioButtonChecked_ShouldThemeToDark_WhenSuccessful()
|
public void IsDarkThemeRadioButtonCheckedShouldThemeToDarkWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
// Assert
|
// Assert
|
||||||
@@ -177,7 +177,7 @@ namespace ViewModelTests
|
|||||||
SendMockIPCConfigMSG,
|
SendMockIPCConfigMSG,
|
||||||
SendRestartAdminIPCMessage,
|
SendRestartAdminIPCMessage,
|
||||||
SendCheckForUpdatesIPCMessage,
|
SendCheckForUpdatesIPCMessage,
|
||||||
generalSettings_file_name);
|
generalSettingsFileName);
|
||||||
Assert.IsFalse(viewModel.IsDarkThemeRadioButtonChecked);
|
Assert.IsFalse(viewModel.IsDarkThemeRadioButtonChecked);
|
||||||
|
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ namespace ViewModelTests
|
|||||||
Assert.IsTrue(modules.ColorPicker);
|
Assert.IsTrue(modules.ColorPicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int UpdateUIThemeMethod(string themeName)
|
public static int UpdateUIThemeMethod(string themeName)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ namespace ViewModelTests
|
|||||||
private Mock<ISettingsUtils> mockImgResizerSettingsUtils;
|
private Mock<ISettingsUtils> mockImgResizerSettingsUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
||||||
mockImgResizerSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
mockImgResizerSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsEnabled_ShouldEnableModule_WhenSuccessful()
|
public void IsEnabledShouldEnableModuleWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -50,7 +50,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void JPEGQualityLevel_ShouldSetValueToTen_WhenSuccessful()
|
public void JPEGQualityLevelShouldSetValueToTenWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -67,7 +67,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void PngInterlaceOption_ShouldSetValueToTen_WhenSuccessful()
|
public void PngInterlaceOptionShouldSetValueToTenWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -84,7 +84,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TiffCompressOption_ShouldSetValueToTen_WhenSuccessful()
|
public void TiffCompressOptionShouldSetValueToTenWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -101,7 +101,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void FileName_ShouldUpdateValue_WhenSuccessful()
|
public void FileNameShouldUpdateValueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -119,7 +119,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void KeepDateModified_ShouldUpdateValue_WhenSuccessful()
|
public void KeepDateModifiedShouldUpdateValueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var settingUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
var settingUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
||||||
@@ -142,7 +142,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Encoder_ShouldUpdateValue_WhenSuccessful()
|
public void EncoderShouldUpdateValueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
var mockIOProvider = IIOProviderMocks.GetMockIOProviderForSaveLoadExists();
|
||||||
@@ -160,7 +160,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AddRow_ShouldAddEmptyImageSize_WhenSuccessful()
|
public void AddRowShouldAddEmptyImageSizeWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
||||||
@@ -176,7 +176,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void DeleteImageSize_ShouldDeleteImageSize_WhenSuccessful()
|
public void DeleteImageSizeShouldDeleteImageSizeWhenSuccessful()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
|
||||||
@@ -194,7 +194,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void UpdateWidthAndHeight_ShouldUpateSize_WhenCorrectValuesAreProvided()
|
public void UpdateWidthAndHeightShouldUpateSizeWhenCorrectValuesAreProvided()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
ImageSize imageSize = new ImageSize()
|
ImageSize imageSize = new ImageSize()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void CombineShortcutLists_ShouldReturnEmptyList_WhenBothArgumentsAreEmptyLists()
|
public void CombineShortcutListsShouldReturnEmptyListWhenBothArgumentsAreEmptyLists()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var firstList = new List<KeysDataModel>();
|
var firstList = new List<KeysDataModel>();
|
||||||
@@ -38,11 +38,11 @@ namespace ViewModelTests
|
|||||||
// Assert
|
// Assert
|
||||||
var expectedResult = new List<AppSpecificKeysDataModel>();
|
var expectedResult = new List<AppSpecificKeysDataModel>();
|
||||||
|
|
||||||
Assert.AreEqual(expectedResult.Count(), result.Count());
|
Assert.AreEqual(expectedResult.Count, result.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void CombineShortcutLists_ShouldReturnListWithOneAllAppsEntry_WhenFirstArgumentHasOneEntryAndSecondArgumentIsEmpty()
|
public void CombineShortcutListsShouldReturnListWithOneAllAppsEntryWhenFirstArgumentHasOneEntryAndSecondArgumentIsEmpty()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var firstList = new List<KeysDataModel>();
|
var firstList = new List<KeysDataModel>();
|
||||||
@@ -63,12 +63,12 @@ namespace ViewModelTests
|
|||||||
expectedEntry.TargetApp = "All Apps";
|
expectedEntry.TargetApp = "All Apps";
|
||||||
expectedResult.Add(expectedEntry);
|
expectedResult.Add(expectedEntry);
|
||||||
var x = expectedResult[0].Equals(result[0]);
|
var x = expectedResult[0].Equals(result[0]);
|
||||||
Assert.AreEqual(expectedResult.Count(), result.Count());
|
Assert.AreEqual(expectedResult.Count, result.Count);
|
||||||
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void CombineShortcutLists_ShouldReturnListWithOneAppSpecificEntry_WhenFirstArgumentIsEmptyAndSecondArgumentHasOneEntry()
|
public void CombineShortcutListsShouldReturnListWithOneAppSpecificEntryWhenFirstArgumentIsEmptyAndSecondArgumentHasOneEntry()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var firstList = new List<KeysDataModel>();
|
var firstList = new List<KeysDataModel>();
|
||||||
@@ -90,12 +90,12 @@ namespace ViewModelTests
|
|||||||
expectedEntry.TargetApp = entry.TargetApp;
|
expectedEntry.TargetApp = entry.TargetApp;
|
||||||
expectedResult.Add(expectedEntry);
|
expectedResult.Add(expectedEntry);
|
||||||
|
|
||||||
Assert.AreEqual(expectedResult.Count(), result.Count());
|
Assert.AreEqual(expectedResult.Count, result.Count);
|
||||||
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void CombineShortcutLists_ShouldReturnListWithOneAllAppsEntryAndOneAppSpecificEntry_WhenFirstArgumentHasOneEntryAndSecondArgumentHasOneEntry()
|
public void CombineShortcutListsShouldReturnListWithOneAllAppsEntryAndOneAppSpecificEntryWhenFirstArgumentHasOneEntryAndSecondArgumentHasOneEntry()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var firstList = new List<KeysDataModel>();
|
var firstList = new List<KeysDataModel>();
|
||||||
@@ -126,7 +126,7 @@ namespace ViewModelTests
|
|||||||
expectedSecondEntry.TargetApp = secondListEntry.TargetApp;
|
expectedSecondEntry.TargetApp = secondListEntry.TargetApp;
|
||||||
expectedResult.Add(expectedSecondEntry);
|
expectedResult.Add(expectedSecondEntry);
|
||||||
|
|
||||||
Assert.AreEqual(expectedResult.Count(), result.Count());
|
Assert.AreEqual(expectedResult.Count, result.Count);
|
||||||
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
Assert.IsTrue(expectedResult[0].Compare(result[0]));
|
||||||
Assert.IsTrue(expectedResult[1].Compare(result[1]));
|
Assert.IsTrue(expectedResult[1].Compare(result[1]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ namespace ViewModelTests
|
|||||||
{
|
{
|
||||||
public int TimesSent { get; set; }
|
public int TimesSent { get; set; }
|
||||||
|
|
||||||
public void OnSend(PowerLauncherSettings settings)
|
// PowerLauncherSettings is unused, but required according to SendCallback's signature.
|
||||||
|
// Naming parameter with discard symbol to suppress FxCop warnings.
|
||||||
|
public void OnSend(PowerLauncherSettings _)
|
||||||
{
|
{
|
||||||
TimesSent++;
|
TimesSent++;
|
||||||
}
|
}
|
||||||
@@ -36,7 +38,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SearchPreference_ShouldUpdatePreferences()
|
public void SearchPreferenceShouldUpdatePreferences()
|
||||||
{
|
{
|
||||||
viewModel.SearchResultPreference = "SearchOptionsAreNotValidated";
|
viewModel.SearchResultPreference = "SearchOptionsAreNotValidated";
|
||||||
viewModel.SearchTypePreference = "SearchOptionsAreNotValidated";
|
viewModel.SearchTypePreference = "SearchOptionsAreNotValidated";
|
||||||
@@ -46,17 +48,23 @@ namespace ViewModelTests
|
|||||||
Assert.IsTrue(mockSettings.Properties.SearchTypePreference == "SearchOptionsAreNotValidated");
|
Assert.IsTrue(mockSettings.Properties.SearchTypePreference == "SearchOptionsAreNotValidated");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code)
|
public static void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code)
|
||||||
|
{
|
||||||
|
if (setting != null)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(win, setting.Win);
|
Assert.AreEqual(win, setting.Win);
|
||||||
Assert.AreEqual(ctrl, setting.Ctrl);
|
Assert.AreEqual(ctrl, setting.Ctrl);
|
||||||
Assert.AreEqual(alt, setting.Alt);
|
Assert.AreEqual(alt, setting.Alt);
|
||||||
Assert.AreEqual(shift, setting.Shift);
|
Assert.AreEqual(shift, setting.Shift);
|
||||||
Assert.AreEqual(code, setting.Code);
|
Assert.AreEqual(code, setting.Code);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Assert.Fail("setting parameter is null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Hotkeys_ShouldUpdateHotkeys()
|
public void HotkeysShouldUpdateHotkeys()
|
||||||
{
|
{
|
||||||
var openPowerLauncher = new HotkeySettings();
|
var openPowerLauncher = new HotkeySettings();
|
||||||
openPowerLauncher.Win = true;
|
openPowerLauncher.Win = true;
|
||||||
@@ -104,7 +112,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Override_ShouldUpdateOverrides()
|
public void OverrideShouldUpdateOverrides()
|
||||||
{
|
{
|
||||||
viewModel.OverrideWinRKey = true;
|
viewModel.OverrideWinRKey = true;
|
||||||
viewModel.OverrideWinSKey = false;
|
viewModel.OverrideWinSKey = false;
|
||||||
@@ -116,7 +124,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void DriveDetectionViewModel_WhenSet_MustUpdateOverrides()
|
public void DriveDetectionViewModelWhenSetMustUpdateOverrides()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
viewModel.DisableDriveDetectionWarning = true;
|
viewModel.DisableDriveDetectionWarning = true;
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ namespace ViewModelTests
|
|||||||
private Mock<ISettingsUtils> mockPowerPreviewSettingsUtils;
|
private Mock<ISettingsUtils> mockPowerPreviewSettingsUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockPowerPreviewSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerPreviewSettings>();
|
mockPowerPreviewSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerPreviewSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SVGRenderIsEnabled_ShouldPrevHandler_WhenSuccessful()
|
public void SVGRenderIsEnabledShouldPrevHandlerWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -45,7 +45,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void SVGThumbnailIsEnabled_ShouldPrevHandler_WhenSuccessful()
|
public void SVGThumbnailIsEnabledShouldPrevHandlerWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -63,7 +63,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MDRenderIsEnabled_ShouldPrevHandler_WhenSuccessful()
|
public void MDRenderIsEnabledShouldPrevHandlerWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
|
|||||||
@@ -17,21 +17,21 @@ namespace ViewModelTests
|
|||||||
public class PowerRename
|
public class PowerRename
|
||||||
{
|
{
|
||||||
public const string ModuleName = PowerRenameSettings.ModuleName;
|
public const string ModuleName = PowerRenameSettings.ModuleName;
|
||||||
public const string generalSettings_file_name = "Test\\PowerRename";
|
public const string generalSettingsFileName = "Test\\PowerRename";
|
||||||
|
|
||||||
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
|
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
|
||||||
|
|
||||||
private Mock<ISettingsUtils> mockPowerRenamePropertiesUtils;
|
private Mock<ISettingsUtils> mockPowerRenamePropertiesUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
||||||
mockPowerRenamePropertiesUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerRenameLocalProperties>();
|
mockPowerRenamePropertiesUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerRenameLocalProperties>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsEnabled_ShouldEnableModule_WhenSuccessful()
|
public void IsEnabledShouldEnableModuleWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -42,14 +42,14 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.IsEnabled = true;
|
viewModel.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MRUEnabled_ShouldSetValue2True_WhenSuccessful()
|
public void MRUEnabledShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -60,7 +60,7 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.MRUEnabled = true;
|
viewModel.MRUEnabled = true;
|
||||||
@@ -70,7 +70,7 @@ namespace ViewModelTests
|
|||||||
public void WhenIsEnabledIsOffAndMRUEnabledIsOffGlobalAndMruShouldBeOff()
|
public void WhenIsEnabledIsOffAndMRUEnabledIsOffGlobalAndMruShouldBeOff()
|
||||||
{
|
{
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
viewModel.IsEnabled = false;
|
viewModel.IsEnabled = false;
|
||||||
viewModel.MRUEnabled = false;
|
viewModel.MRUEnabled = false;
|
||||||
@@ -82,7 +82,7 @@ namespace ViewModelTests
|
|||||||
public void WhenIsEnabledIsOffAndMRUEnabledIsOnGlobalAndMruShouldBeOff()
|
public void WhenIsEnabledIsOffAndMRUEnabledIsOnGlobalAndMruShouldBeOff()
|
||||||
{
|
{
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
viewModel.IsEnabled = false;
|
viewModel.IsEnabled = false;
|
||||||
viewModel.MRUEnabled = true;
|
viewModel.MRUEnabled = true;
|
||||||
@@ -94,7 +94,7 @@ namespace ViewModelTests
|
|||||||
public void WhenIsEnabledIsOnAndMRUEnabledIsOffGlobalAndMruShouldBeOff()
|
public void WhenIsEnabledIsOnAndMRUEnabledIsOffGlobalAndMruShouldBeOff()
|
||||||
{
|
{
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
viewModel.IsEnabled = true;
|
viewModel.IsEnabled = true;
|
||||||
viewModel.MRUEnabled = false;
|
viewModel.MRUEnabled = false;
|
||||||
@@ -106,7 +106,7 @@ namespace ViewModelTests
|
|||||||
public void WhenIsEnabledIsOnAndMRUEnabledIsOnGlobalAndMruShouldBeOn()
|
public void WhenIsEnabledIsOnAndMRUEnabledIsOnGlobalAndMruShouldBeOn()
|
||||||
{
|
{
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
viewModel.IsEnabled = true;
|
viewModel.IsEnabled = true;
|
||||||
viewModel.MRUEnabled = true;
|
viewModel.MRUEnabled = true;
|
||||||
@@ -115,7 +115,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void EnabledOnContextMenu_ShouldSetValue2True_WhenSuccessful()
|
public void EnabledOnContextMenuShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -126,14 +126,14 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.EnabledOnContextMenu = true;
|
viewModel.EnabledOnContextMenu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void EnabledOnContextExtendedMenu_ShouldSetValue2True_WhenSuccessful()
|
public void EnabledOnContextExtendedMenuShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -144,14 +144,14 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.EnabledOnContextMenu = true;
|
viewModel.EnabledOnContextMenu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void RestoreFlagsOnLaunch_ShouldSetValue2True_WhenSuccessful()
|
public void RestoreFlagsOnLaunchShouldSetValue2TrueWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -162,14 +162,14 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.RestoreFlagsOnLaunch = true;
|
viewModel.RestoreFlagsOnLaunch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MaxDispListNum_ShouldSetMaxSuggListTo20_WhenSuccessful()
|
public void MaxDispListNumShouldSetMaxSuggListTo20WhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
Func<string, int> SendMockIPCConfigMSG = msg =>
|
Func<string, int> SendMockIPCConfigMSG = msg =>
|
||||||
@@ -180,7 +180,7 @@ namespace ViewModelTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// arrange
|
// arrange
|
||||||
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettings_file_name);
|
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
viewModel.MaxDispListNum = 20;
|
viewModel.MaxDispListNum = 20;
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ namespace ViewModelTests
|
|||||||
private Mock<ISettingsUtils> mockShortcutGuideSettingsUtils;
|
private Mock<ISettingsUtils> mockShortcutGuideSettingsUtils;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void SetUp_StubSettingUtils()
|
public void SetUpStubSettingUtils()
|
||||||
{
|
{
|
||||||
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
|
||||||
mockShortcutGuideSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ShortcutGuideSettings>();
|
mockShortcutGuideSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ShortcutGuideSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void IsEnabled_ShouldEnableModule_WhenSuccessful()
|
public void IsEnabledShouldEnableModuleWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
// Initialize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
@@ -49,7 +49,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ThemeIndex_ShouldSetThemeToDark_WhenSuccessful()
|
public void ThemeIndexShouldSetThemeToDarkWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
// Initialize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
@@ -70,7 +70,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void PressTime_ShouldSetPressTimeToOneHundred_WhenSuccessful()
|
public void PressTimeShouldSetPressTimeToOneHundredWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
// Initialize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
@@ -90,7 +90,7 @@ namespace ViewModelTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void OverlayOpacity_ShouldSeOverlayOpacityToOneHundred_WhenSuccessful()
|
public void OverlayOpacityShouldSeOverlayOpacityToOneHundredWhenSuccessful()
|
||||||
{
|
{
|
||||||
// Assert
|
// Assert
|
||||||
// Initialize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
|
|||||||
Reference in New Issue
Block a user