Assert was switched in these instances, so I changed it to the "expected, actual" (#7142)

Co-authored-by: p-storm <paul.de.man@gmail.com>
This commit is contained in:
P-Storm 2020-10-07 22:12:59 +02:00 committed by GitHub
parent 0c0aec0f2a
commit d011843113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 157 additions and 152 deletions

View File

@ -172,7 +172,7 @@ namespace ViewModelTests
viewModel.AddRow(); viewModel.AddRow();
// Assert // Assert
Assert.AreEqual(viewModel.Sizes.Count, sizeOfOriginalArray + 1); Assert.AreEqual(sizeOfOriginalArray + 1, viewModel.Sizes.Count);
} }
[TestMethod] [TestMethod]
@ -189,7 +189,7 @@ namespace ViewModelTests
viewModel.DeleteImageSize(0); viewModel.DeleteImageSize(0);
// Assert // Assert
Assert.AreEqual(viewModel.Sizes.Count, sizeOfOriginalArray - 1); Assert.AreEqual(sizeOfOriginalArray - 1, viewModel.Sizes.Count);
Assert.IsFalse(viewModel.Sizes.Contains(deleteCandidate)); Assert.IsFalse(viewModel.Sizes.Contains(deleteCandidate));
} }

View File

@ -51,7 +51,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
var applications = UWP.All(); var applications = UWP.All();
// Assert // Assert
Assert.AreEqual(applications.Length, 2); Assert.AreEqual(2, applications.Length);
Assert.IsTrue(applications.FindAll(x => x.Name == "DevelopmentApp").Length > 0); Assert.IsTrue(applications.FindAll(x => x.Name == "DevelopmentApp").Length > 0);
Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0); Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0);
} }
@ -70,7 +70,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
var applications = UWP.All(); var applications = UWP.All();
// Assert // Assert
Assert.AreEqual(applications.Length, 1); Assert.AreEqual(1, applications.Length);
Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0); Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0);
} }
@ -89,7 +89,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
var applications = UWP.All(); var applications = UWP.All();
// Assert // Assert
Assert.AreEqual(applications.Length, 0); Assert.AreEqual(0, applications.Length);
} }
} }
} }

View File

@ -256,7 +256,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel()); Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
// Assert // Assert
Assert.AreEqual(apps.Length, 1); Assert.AreEqual(1, apps.Length);
} }
[Test] [Test]
@ -273,7 +273,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel()); Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
// Assert // Assert
Assert.AreEqual(apps.Length, 1); Assert.AreEqual(1, apps.Length);
} }
[Test] [Test]
@ -289,7 +289,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel()); Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
// Assert // Assert
Assert.AreEqual(apps.Length, 1); Assert.AreEqual(1, apps.Length);
} }
[Test] [Test]
@ -306,7 +306,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel()); Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
// Assert // Assert
Assert.AreEqual(apps.Length, 1); Assert.AreEqual(1, apps.Length);
Assert.IsTrue(!string.IsNullOrEmpty(apps[0].LnkResolvedPath)); Assert.IsTrue(!string.IsNullOrEmpty(apps[0].LnkResolvedPath));
} }
@ -325,7 +325,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel()); Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
// Assert // Assert
Assert.AreEqual(apps.Length, 3); Assert.AreEqual(3, apps.Length);
} }
[Test] [Test]
@ -442,10 +442,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _pinnedWebpage.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _pinnedWebpage.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_run_as_administrator); Assert.AreEqual(Properties.Resources.wox_plugin_program_run_as_administrator, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[2].Title);
} }
[Test] [Test]
@ -458,9 +458,9 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _dummyInternetShortcutApp.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _dummyInternetShortcutApp.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 2); Assert.AreEqual(2, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[1].Title);
} }
[Test] [Test]
@ -473,10 +473,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _chrome.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _chrome.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_run_as_administrator); Assert.AreEqual(Properties.Resources.wox_plugin_program_run_as_administrator, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[2].Title);
} }
[Test] [Test]
@ -489,10 +489,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _cmdRunCommand.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _cmdRunCommand.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_run_as_administrator); Assert.AreEqual(Properties.Resources.wox_plugin_program_run_as_administrator, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[2].Title);
} }
[Test] [Test]
@ -505,10 +505,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _dummyAppRefApp.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _dummyAppRefApp.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_run_as_administrator); Assert.AreEqual(Properties.Resources.wox_plugin_program_run_as_administrator, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[2].Title);
} }
[Test] [Test]
@ -521,10 +521,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _dummyShortcutApp.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _dummyShortcutApp.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_run_as_administrator); Assert.AreEqual(Properties.Resources.wox_plugin_program_run_as_administrator, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[2].Title);
} }
[Test] [Test]
@ -537,9 +537,9 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _dummyFolderApp.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _dummyFolderApp.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 2); Assert.AreEqual(2, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[1].Title);
} }
[Test] [Test]
@ -552,9 +552,9 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
List<ContextMenuResult> contextMenuResults = _dummyGenericFileApp.ContextMenus(mock.Object); List<ContextMenuResult> contextMenuResults = _dummyGenericFileApp.ContextMenus(mock.Object);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 2); Assert.AreEqual(2, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Properties.Resources.wox_plugin_program_open_containing_folder); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_containing_folder, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Properties.Resources.wox_plugin_program_open_in_console); Assert.AreEqual(Properties.Resources.wox_plugin_program_open_in_console, contextMenuResults[1].Title);
} }
[Test] [Test]

View File

@ -42,8 +42,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay); string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay);
// Assert // Assert
Assert.AreEqual(pathFromQueue, appPath); Assert.AreEqual(appPath, pathFromQueue);
Assert.AreEqual(eventHandlingQueue.Count, 0); Assert.AreEqual(0, eventHandlingQueue.Count);
} }
[TestCase(5)] [TestCase(5)]
@ -68,8 +68,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay); string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay);
// Assert // Assert
Assert.AreEqual(pathFromQueue, firstAppPath); Assert.AreEqual(firstAppPath, pathFromQueue);
Assert.AreEqual(eventHandlingQueue.Count, itemCount); Assert.AreEqual(itemCount, eventHandlingQueue.Count);
} }
[TestCase(5)] [TestCase(5)]
@ -99,8 +99,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay); string pathFromQueue = EventHandler.GetAppPathFromQueue(eventHandlingQueue, dequeueDelay);
// Assert // Assert
Assert.AreEqual(pathFromQueue, firstAppPath); Assert.AreEqual(firstAppPath, pathFromQueue);
Assert.AreEqual(eventHandlingQueue.Count, itemCount * 2); Assert.AreEqual(itemCount * 2, eventHandlingQueue.Count);
} }
} }
} }

View File

@ -63,13 +63,13 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
// Act // Act
win32ProgramRepository.Add(item1); win32ProgramRepository.Add(item1);
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
// To add an item with the same hashCode, ie, same name, exename and fullPath // To add an item with the same hashCode, ie, same name, exename and fullPath
win32ProgramRepository.Add(item2); win32ProgramRepository.Add(item2);
// Assert, count still remains 1 because they are duplicate items // Assert, count still remains 1 because they are duplicate items
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
} }
[TestCase("path.appref-ms")] [TestCase("path.appref-ms")]
@ -83,8 +83,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Created += null, e); _fileSystemMocks[0].Raise(m => m.Created += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.AreEqual(win32ProgramRepository.ElementAt(0).AppType, Win32Program.ApplicationType.ApprefApplication); Assert.AreEqual(Win32Program.ApplicationType.ApprefApplication, win32ProgramRepository.ElementAt(0).AppType);
} }
[TestCase("directory", "path.appref-ms")] [TestCase("directory", "path.appref-ms")]
@ -102,7 +102,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Deleted += null, e); _fileSystemMocks[0].Raise(m => m.Deleted += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")] [TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")]
@ -123,7 +123,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Renamed += null, e); _fileSystemMocks[0].Raise(m => m.Renamed += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.IsTrue(win32ProgramRepository.Contains(newitem)); Assert.IsTrue(win32ProgramRepository.Contains(newitem));
Assert.IsFalse(win32ProgramRepository.Contains(olditem)); Assert.IsFalse(win32ProgramRepository.Contains(olditem));
} }
@ -144,8 +144,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Created += null, e); _fileSystemMocks[0].Raise(m => m.Created += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.AreEqual(win32ProgramRepository.ElementAt(0).AppType, Win32Program.ApplicationType.Win32Application); Assert.AreEqual(Win32Program.ApplicationType.Win32Application, win32ProgramRepository.ElementAt(0).AppType);
} }
[TestCase("directory", "path.exe")] [TestCase("directory", "path.exe")]
@ -168,7 +168,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Deleted += null, e); _fileSystemMocks[0].Raise(m => m.Deleted += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")] [TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")]
@ -194,7 +194,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Renamed += null, e); _fileSystemMocks[0].Raise(m => m.Renamed += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.IsTrue(win32ProgramRepository.Contains(newitem)); Assert.IsTrue(win32ProgramRepository.Contains(newitem));
Assert.IsFalse(win32ProgramRepository.Contains(olditem)); Assert.IsFalse(win32ProgramRepository.Contains(olditem));
} }
@ -217,7 +217,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Created += null, e); _fileSystemMocks[0].Raise(m => m.Created += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("path.exe")] [TestCase("path.exe")]
@ -245,7 +245,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Changed += null, e); _fileSystemMocks[0].Raise(m => m.Changed += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("directory", "path.url")] [TestCase("directory", "path.url")]
@ -268,7 +268,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Deleted += null, e); _fileSystemMocks[0].Raise(m => m.Deleted += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("directory", "oldpath.url", "newpath.url")] [TestCase("directory", "oldpath.url", "newpath.url")]
@ -294,7 +294,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Renamed += null, e); _fileSystemMocks[0].Raise(m => m.Renamed += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.IsTrue(win32ProgramRepository.Contains(newitem)); Assert.IsTrue(win32ProgramRepository.Contains(newitem));
Assert.IsFalse(win32ProgramRepository.Contains(olditem)); Assert.IsFalse(win32ProgramRepository.Contains(olditem));
} }
@ -326,7 +326,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Deleted += null, e); _fileSystemMocks[0].Raise(m => m.Deleted += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 0); Assert.AreEqual(0, win32ProgramRepository.Count());
} }
[TestCase("directory", "oldpath.lnk", "path.lnk")] [TestCase("directory", "oldpath.lnk", "path.lnk")]
@ -365,7 +365,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
_fileSystemMocks[0].Raise(m => m.Renamed += null, e); _fileSystemMocks[0].Raise(m => m.Renamed += null, e);
// Assert // Assert
Assert.AreEqual(win32ProgramRepository.Count(), 1); Assert.AreEqual(1, win32ProgramRepository.Count());
Assert.IsTrue(win32ProgramRepository.Contains(newitem)); Assert.IsTrue(win32ProgramRepository.Contains(newitem));
Assert.IsFalse(win32ProgramRepository.Contains(olditem)); Assert.IsFalse(win32ProgramRepository.Contains(olditem));
} }

View File

@ -22,7 +22,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -37,7 +37,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -52,7 +52,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -67,7 +67,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -82,7 +82,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -98,7 +98,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, expectedAutoCompleteText); Assert.AreEqual(expectedAutoCompleteText, autoCompleteText);
} }
[Test] [Test]
@ -114,7 +114,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query); string autoCompleteText = MainViewModel.GetAutoCompleteText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, expectedAutoCompleteText); Assert.AreEqual(expectedAutoCompleteText, autoCompleteText);
} }
[Test] [Test]
@ -129,7 +129,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -144,7 +144,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, string.Empty); Assert.AreEqual(string.Empty, autoCompleteText);
} }
[Test] [Test]
@ -159,7 +159,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, input); Assert.AreEqual(input, autoCompleteText);
} }
[Test] [Test]
@ -174,7 +174,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, input); Assert.AreEqual(input, autoCompleteText);
} }
[Test] [Test]
@ -190,7 +190,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, expectedAutoCompleteText); Assert.AreEqual(expectedAutoCompleteText, autoCompleteText);
} }
[Test] [Test]
@ -205,7 +205,7 @@ namespace Wox.Test
string autoCompleteText = MainViewModel.GetSearchText(index, input, query); string autoCompleteText = MainViewModel.GetSearchText(index, input, query);
// Assert // Assert
Assert.AreEqual(autoCompleteText, input); Assert.AreEqual(input, autoCompleteText);
} }
} }
} }

View File

@ -26,9 +26,9 @@ namespace Wox.Test.Plugins
List<ContextMenuResult> contextMenuResults = contextMenuLoader.LoadContextMenus(result); List<ContextMenuResult> contextMenuResults = contextMenuLoader.LoadContextMenus(result);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 2); Assert.AreEqual(2, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path); Assert.AreEqual(Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console); Assert.AreEqual(Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console, contextMenuResults[1].Title);
} }
[Test] [Test]
@ -45,10 +45,10 @@ namespace Wox.Test.Plugins
List<ContextMenuResult> contextMenuResults = contextMenuLoader.LoadContextMenus(result); List<ContextMenuResult> contextMenuResults = contextMenuLoader.LoadContextMenus(result);
// Assert // Assert
Assert.AreEqual(contextMenuResults.Count, 3); Assert.AreEqual(3, contextMenuResults.Count);
Assert.AreEqual(contextMenuResults[0].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_containing_folder); Assert.AreEqual(Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_containing_folder, contextMenuResults[0].Title);
Assert.AreEqual(contextMenuResults[1].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path); Assert.AreEqual(Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path, contextMenuResults[1].Title);
Assert.AreEqual(contextMenuResults[2].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console); Assert.AreEqual(Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console, contextMenuResults[2].Title);
} }
} }
} }

View File

@ -22,7 +22,7 @@ namespace Wox.Test.Plugins
res.ToolTipData = new ToolTipData(toolTipText, string.Empty); res.ToolTipData = new ToolTipData(toolTipText, string.Empty);
// Assert // Assert
Assert.AreEqual(res.ToolTipVisibility, Visibility.Visible); Assert.AreEqual(Visibility.Visible, res.ToolTipVisibility);
} }
[Test] [Test]
@ -32,7 +32,7 @@ namespace Wox.Test.Plugins
Result res = new Result(); Result res = new Result();
// Assert // Assert
Assert.AreEqual(res.ToolTipVisibility, Visibility.Collapsed); Assert.AreEqual(Visibility.Collapsed, res.ToolTipVisibility);
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace Wox.Test.Plugins
// Assert // Assert
Assert.IsNotNull(queryHelper); Assert.IsNotNull(queryHelper);
Assert.AreEqual(queryHelper.QueryMaxResults, maxCount); Assert.AreEqual(maxCount, queryHelper.QueryMaxResults);
} }
[Test] [Test]
@ -281,11 +281,11 @@ namespace Wox.Test.Plugins
List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result); List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result);
// Assert // Assert
Assert.AreEqual(contextMenuItems.Count, 4); Assert.AreEqual(4, contextMenuItems.Count);
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder, contextMenuItems[0].Title);
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_run_as_administrator); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_run_as_administrator, contextMenuItems[1].Title);
Assert.AreEqual(contextMenuItems[2].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path, contextMenuItems[2].Title);
Assert.AreEqual(contextMenuItems[3].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console, contextMenuItems[3].Title);
} }
[TestCase("item.pdf")] [TestCase("item.pdf")]
@ -309,10 +309,10 @@ namespace Wox.Test.Plugins
List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result); List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result);
// Assert // Assert
Assert.AreEqual(contextMenuItems.Count, 3); Assert.AreEqual(3, contextMenuItems.Count);
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder, contextMenuItems[0].Title);
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path, contextMenuItems[1].Title);
Assert.AreEqual(contextMenuItems[2].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console, contextMenuItems[2].Title);
} }
[TestCase("C:/DummyFolder")] [TestCase("C:/DummyFolder")]
@ -334,9 +334,9 @@ namespace Wox.Test.Plugins
List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result); List<ContextMenuResult> contextMenuItems = contextMenuLoader.LoadContextMenus(result);
// Assert // Assert
Assert.AreEqual(contextMenuItems.Count, 2); Assert.AreEqual(2, contextMenuItems.Count);
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path, contextMenuItems[0].Title);
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console); Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console, contextMenuItems[1].Title);
} }
[TestCase(0, false, ExpectedResult = true)] [TestCase(0, false, ExpectedResult = true)]

View File

@ -25,7 +25,7 @@ namespace Wox.Test
rvm.SelectedItem = selectedItem; rvm.SelectedItem = selectedItem;
// Assert // Assert
Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, ResultViewModel.NoSelectionIndex); Assert.AreEqual(ResultViewModel.NoSelectionIndex, selectedItem.ContextMenuSelectedIndex);
} }
[Test] [Test]
@ -45,7 +45,7 @@ namespace Wox.Test
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
// Assert // Assert
Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, 0); Assert.AreEqual(0, selectedItem.ContextMenuSelectedIndex);
} }
[Test] [Test]
@ -65,7 +65,7 @@ namespace Wox.Test
rvm.SelectNextContextMenuItem(); rvm.SelectNextContextMenuItem();
// Assert // Assert
Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, 0); Assert.AreEqual(0, selectedItem.ContextMenuSelectedIndex);
} }
[Test] [Test]
@ -96,7 +96,7 @@ namespace Wox.Test
rvm.SelectPreviousContextMenuItem(); rvm.SelectPreviousContextMenuItem();
// Assert // Assert
Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, 1); Assert.AreEqual(1, selectedItem.ContextMenuSelectedIndex);
} }
[Test] [Test]
@ -117,7 +117,7 @@ namespace Wox.Test
rvm.SelectPreviousContextMenuItem(); rvm.SelectPreviousContextMenuItem();
// Assert // Assert
Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, ResultViewModel.NoSelectionIndex); Assert.AreEqual(ResultViewModel.NoSelectionIndex, selectedItem.ContextMenuSelectedIndex);
} }
[Test] [Test]

View File

@ -31,7 +31,8 @@ namespace PreviewPaneUnitTests
string html = Markdown.ToHtml(mdString, markdownPipeline); string html = Markdown.ToHtml(mdString, markdownPipeline);
// Assert // Assert
Assert.AreEqual(html, "<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th>A</th>\n<th>B</th>\n</tr>\n</thead>\n</table>\n"); const string expected = "<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th>A</th>\n<th>B</th>\n</tr>\n</thead>\n</table>\n";
Assert.AreEqual(expected, html);
} }
[TestMethod] [TestMethod]
@ -46,7 +47,8 @@ namespace PreviewPaneUnitTests
string html = Markdown.ToHtml(mdString, markdownPipeline); string html = Markdown.ToHtml(mdString, markdownPipeline);
// Assert // Assert
Assert.AreEqual(html, "<blockquote class=\"blockquote\">\n<p>Blockquotes.</p>\n</blockquote>\n"); const string expected = "<blockquote class=\"blockquote\">\n<p>Blockquotes.</p>\n</blockquote>\n";
Assert.AreEqual(expected, html);
} }
[TestMethod] [TestMethod]
@ -61,7 +63,8 @@ namespace PreviewPaneUnitTests
string html = Markdown.ToHtml(mdString, markdownPipeline); string html = Markdown.ToHtml(mdString, markdownPipeline);
// Assert // Assert
Assert.AreEqual(html, "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n"); const string expected = "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n";
Assert.AreEqual(expected, html);
} }
[TestMethod] [TestMethod]
@ -76,7 +79,8 @@ namespace PreviewPaneUnitTests
string html = Markdown.ToHtml(mdString, markdownPipeline); string html = Markdown.ToHtml(mdString, markdownPipeline);
// Assert // Assert
Assert.AreEqual(html, "<figure class=\"figure\">\n<figcaption class=\"figure-caption\">This is a caption</figcaption>\n</figure>\n"); const string expected = "<figure class=\"figure\">\n<figcaption class=\"figure-caption\">This is a caption</figcaption>\n</figure>\n";
Assert.AreEqual(expected, html);
} }
[TestMethod] [TestMethod]
@ -92,8 +96,9 @@ namespace PreviewPaneUnitTests
string html = Markdown.ToHtml(mdString, markdownPipeline); string html = Markdown.ToHtml(mdString, markdownPipeline);
// Assert // Assert
Assert.AreEqual(count, 1); Assert.AreEqual(1, count);
Assert.AreEqual(html, "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n"); const string expected = "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n";
Assert.AreEqual(expected, html);
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace PreviewPaneUnitTests
markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithExternalImage.txt"); markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithExternalImage.txt");
// Assert // Assert
Assert.AreEqual(markdownPreviewHandlerControl.Controls.Count, 2); Assert.AreEqual(2, markdownPreviewHandlerControl.Controls.Count);
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt));
} }
} }
@ -38,7 +38,7 @@ namespace PreviewPaneUnitTests
markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithExternalImage.txt"); markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithExternalImage.txt");
// Assert // Assert
Assert.AreEqual(markdownPreviewHandlerControl.Controls.Count, 2); Assert.AreEqual(2, markdownPreviewHandlerControl.Controls.Count);
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox));
} }
} }
@ -53,7 +53,7 @@ namespace PreviewPaneUnitTests
markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithHTMLImageTag.txt"); markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithHTMLImageTag.txt");
// Assert // Assert
Assert.AreEqual(markdownPreviewHandlerControl.Controls.Count, 2); Assert.AreEqual(2, markdownPreviewHandlerControl.Controls.Count);
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox));
} }
} }
@ -68,7 +68,7 @@ namespace PreviewPaneUnitTests
markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithScript.txt"); markdownPreviewHandlerControl.DoPreview<string>("HelperFiles/MarkdownWithScript.txt");
// Assert // Assert
Assert.AreEqual(markdownPreviewHandlerControl.Controls.Count, 1); Assert.AreEqual(1, markdownPreviewHandlerControl.Controls.Count);
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt));
} }
} }
@ -85,11 +85,11 @@ namespace PreviewPaneUnitTests
// Assert // Assert
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[0], typeof(WebBrowserExt));
Assert.IsNotNull(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).DocumentText); Assert.IsNotNull(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).DocumentText);
Assert.AreEqual(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).Dock, DockStyle.Fill); Assert.AreEqual(DockStyle.Fill, ((WebBrowser)markdownPreviewHandlerControl.Controls[0]).Dock);
Assert.AreEqual(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).IsWebBrowserContextMenuEnabled, false); Assert.AreEqual(false, ((WebBrowser)markdownPreviewHandlerControl.Controls[0]).IsWebBrowserContextMenuEnabled);
Assert.AreEqual(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).ScriptErrorsSuppressed, true); Assert.AreEqual(true, ((WebBrowser)markdownPreviewHandlerControl.Controls[0]).ScriptErrorsSuppressed);
Assert.AreEqual(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).ScrollBarsEnabled, true); Assert.AreEqual(true, ((WebBrowser)markdownPreviewHandlerControl.Controls[0]).ScrollBarsEnabled);
Assert.AreEqual(((WebBrowser)markdownPreviewHandlerControl.Controls[0]).AllowNavigation, false); Assert.AreEqual(false, ((WebBrowser)markdownPreviewHandlerControl.Controls[0]).AllowNavigation);
} }
} }
@ -105,10 +105,10 @@ namespace PreviewPaneUnitTests
// Assert // Assert
Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox)); Assert.IsInstanceOfType(markdownPreviewHandlerControl.Controls[1], typeof(RichTextBox));
Assert.IsNotNull(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Text); Assert.IsNotNull(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Text);
Assert.AreEqual(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Dock, DockStyle.Top); Assert.AreEqual(DockStyle.Top, ((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Dock);
Assert.AreEqual(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).BorderStyle, BorderStyle.None); Assert.AreEqual(BorderStyle.None, ((RichTextBox)markdownPreviewHandlerControl.Controls[1]).BorderStyle);
Assert.AreEqual(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).BackColor, Color.LightYellow); Assert.AreEqual(Color.LightYellow, ((RichTextBox)markdownPreviewHandlerControl.Controls[1]).BackColor);
Assert.AreEqual(((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Multiline, true); Assert.AreEqual(true, ((RichTextBox)markdownPreviewHandlerControl.Controls[1]).Multiline);
} }
} }
} }

View File

@ -38,7 +38,7 @@ namespace PreviewHandlerCommonUnitTests
fileBasedPreviewHandler.Initialize(filePath, grfMode); fileBasedPreviewHandler.Initialize(filePath, grfMode);
// Assert // Assert
Assert.AreEqual(fileBasedPreviewHandler.FilePath, filePath); Assert.AreEqual(filePath, fileBasedPreviewHandler.FilePath);
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace PreviewHandlerCommonUnitTests
streamBasedPreviewHandler.Initialize(stream, grfMode); streamBasedPreviewHandler.Initialize(stream, grfMode);
// Assert // Assert
Assert.AreEqual(streamBasedPreviewHandler.Stream, stream); Assert.AreEqual(stream, streamBasedPreviewHandler.Stream);
} }
} }
} }

View File

@ -50,7 +50,7 @@ namespace PreviewHandlerCommonUnitTests
using (var streamWrapper = new ReadonlyStream(streamMock.Object)) using (var streamWrapper = new ReadonlyStream(streamMock.Object))
{ {
// Assert // Assert
Assert.AreEqual(streamWrapper.CanRead, true); Assert.AreEqual(true, streamWrapper.CanRead);
} }
} }
@ -64,7 +64,7 @@ namespace PreviewHandlerCommonUnitTests
using (var streamWrapper = new ReadonlyStream(streamMock.Object)) using (var streamWrapper = new ReadonlyStream(streamMock.Object))
{ {
// Assert // Assert
Assert.AreEqual(streamWrapper.CanSeek, true); Assert.AreEqual(true, streamWrapper.CanSeek);
} }
} }
@ -78,7 +78,7 @@ namespace PreviewHandlerCommonUnitTests
using (var streamWrapper = new ReadonlyStream(streamMock.Object)) using (var streamWrapper = new ReadonlyStream(streamMock.Object))
{ {
// Assert // Assert
Assert.AreEqual(streamWrapper.CanWrite, false); Assert.AreEqual(false, streamWrapper.CanWrite);
} }
} }
@ -101,7 +101,7 @@ namespace PreviewHandlerCommonUnitTests
var actualLength = streamWrapper.Length; var actualLength = streamWrapper.Length;
// Assert // Assert
Assert.AreEqual(actualLength, streamLength); Assert.AreEqual(streamLength, actualLength);
} }
} }
@ -127,7 +127,7 @@ namespace PreviewHandlerCommonUnitTests
var actualPosition = streamWrapper.Position; var actualPosition = streamWrapper.Position;
// Assert // Assert
Assert.AreEqual(actualPosition, currPosition); Assert.AreEqual(currPosition, actualPosition);
streamMock.Verify(_ => _.Seek(It.Is<long>(offset => offset == expectedOffset), It.Is<int>(dworigin => dworigin == expectedDwOrigin), It.IsAny<IntPtr>()), Times.Once); streamMock.Verify(_ => _.Seek(It.Is<long>(offset => offset == expectedOffset), It.Is<int>(dworigin => dworigin == expectedDwOrigin), It.IsAny<IntPtr>()), Times.Once);
} }
} }
@ -207,7 +207,7 @@ namespace PreviewHandlerCommonUnitTests
var actualPosition = streamWrapper.Seek(0, SeekOrigin.Begin); var actualPosition = streamWrapper.Seek(0, SeekOrigin.Begin);
// Assert // Assert
Assert.AreEqual(position, actualPosition); Assert.AreEqual(actualPosition, position);
} }
} }

View File

@ -28,7 +28,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(svgPreviewControl.Controls.Count, 1); Assert.AreEqual(1, svgPreviewControl.Controls.Count);
Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(WebBrowserExt)); Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(WebBrowserExt));
} }
} }
@ -57,7 +57,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(((WebBrowser)svgPreviewControl.Controls[0]).IsWebBrowserContextMenuEnabled, false); Assert.AreEqual(false, ((WebBrowser)svgPreviewControl.Controls[0]).IsWebBrowserContextMenuEnabled);
} }
} }
@ -71,7 +71,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(((WebBrowser)svgPreviewControl.Controls[0]).Dock, DockStyle.Fill); Assert.AreEqual(DockStyle.Fill, ((WebBrowser)svgPreviewControl.Controls[0]).Dock);
} }
} }
@ -85,7 +85,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(((WebBrowser)svgPreviewControl.Controls[0]).ScriptErrorsSuppressed, true); Assert.AreEqual(true, ((WebBrowser)svgPreviewControl.Controls[0]).ScriptErrorsSuppressed);
} }
} }
@ -99,7 +99,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(((WebBrowser)svgPreviewControl.Controls[0]).ScrollBarsEnabled, true); Assert.AreEqual(true, ((WebBrowser)svgPreviewControl.Controls[0]).ScrollBarsEnabled);
} }
} }
@ -113,7 +113,7 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>")); svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
// Assert // Assert
Assert.AreEqual(((WebBrowser)svgPreviewControl.Controls[0]).AllowNavigation, false); Assert.AreEqual(false, ((WebBrowser)svgPreviewControl.Controls[0]).AllowNavigation);
} }
} }
@ -134,13 +134,13 @@ namespace SvgPreviewHandlerUnitTests
// Assert // Assert
Assert.IsFalse(string.IsNullOrWhiteSpace(textBox.Text)); Assert.IsFalse(string.IsNullOrWhiteSpace(textBox.Text));
Assert.AreEqual(svgPreviewControl.Controls.Count, 1); Assert.AreEqual(1, svgPreviewControl.Controls.Count);
Assert.AreEqual(textBox.Dock, DockStyle.Top); Assert.AreEqual(DockStyle.Top, textBox.Dock);
Assert.AreEqual(textBox.BackColor, Color.LightYellow); Assert.AreEqual(Color.LightYellow, textBox.BackColor);
Assert.IsTrue(textBox.Multiline); Assert.IsTrue(textBox.Multiline);
Assert.IsTrue(textBox.ReadOnly); Assert.IsTrue(textBox.ReadOnly);
Assert.AreEqual(textBox.ScrollBars, RichTextBoxScrollBars.None); Assert.AreEqual(RichTextBoxScrollBars.None, textBox.ScrollBars);
Assert.AreEqual(textBox.BorderStyle, BorderStyle.None); Assert.AreEqual(BorderStyle.None, textBox.BorderStyle);
} }
} }
@ -165,8 +165,8 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.Width += incrementParentControlWidth; svgPreviewControl.Width += incrementParentControlWidth;
// Assert // Assert
Assert.AreEqual(initialParentWidth, initialTextBoxWidth); Assert.AreEqual(initialTextBoxWidth, initialParentWidth);
Assert.AreEqual(finalParentWidth, textBox.Width); Assert.AreEqual(textBox.Width, finalParentWidth);
} }
} }
@ -187,7 +187,7 @@ namespace SvgPreviewHandlerUnitTests
// Assert // Assert
Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(RichTextBox)); Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(RichTextBox));
Assert.IsInstanceOfType(svgPreviewControl.Controls[1], typeof(WebBrowserExt)); Assert.IsInstanceOfType(svgPreviewControl.Controls[1], typeof(WebBrowserExt));
Assert.AreEqual(svgPreviewControl.Controls.Count, 2); Assert.AreEqual(2, svgPreviewControl.Controls.Count);
} }
} }
@ -208,7 +208,7 @@ namespace SvgPreviewHandlerUnitTests
// Assert // Assert
Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(WebBrowserExt)); Assert.IsInstanceOfType(svgPreviewControl.Controls[0], typeof(WebBrowserExt));
Assert.AreEqual(svgPreviewControl.Controls.Count, 1); Assert.AreEqual(1, svgPreviewControl.Controls.Count);
} }
} }
@ -233,8 +233,8 @@ namespace SvgPreviewHandlerUnitTests
svgPreviewControl.Width += incrementParentControlWidth; svgPreviewControl.Width += incrementParentControlWidth;
// Assert // Assert
Assert.AreEqual(initialParentWidth, initialTextBoxWidth); Assert.AreEqual(initialTextBoxWidth, initialParentWidth);
Assert.AreEqual(finalParentWidth, textBox.Width); Assert.AreEqual(textBox.Width, finalParentWidth);
} }
} }

View File

@ -176,10 +176,10 @@ namespace PowerToysTests
Assert.AreEqual(4, zones.Count); Assert.AreEqual(4, zones.Count);
//check splitted zone //check splitted zone
Assert.AreEqual(zones[0].Rect.Top, defaultSpacing); Assert.AreEqual(defaultSpacing, zones[0].Rect.Top);
Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - splitPos + defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - splitPos + defaultSpacing / 2) <= 2);
Assert.IsTrue(Math.Abs(zones[1].Rect.Top - splitPos - defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[1].Rect.Top - splitPos - defaultSpacing / 2) <= 2);
Assert.AreEqual(zones[1].Rect.Bottom, Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing); Assert.AreEqual(Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing, zones[1].Rect.Bottom);
} }
[TestMethod] [TestMethod]
@ -201,10 +201,10 @@ namespace PowerToysTests
zones = gridEditor.FindElementsByClassName("GridZone"); zones = gridEditor.FindElementsByClassName("GridZone");
Assert.AreEqual(4, zones.Count); Assert.AreEqual(4, zones.Count);
Assert.AreEqual(zones[0].Rect.Top, defaultSpacing); Assert.AreEqual(defaultSpacing, zones[0].Rect.Top);
Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - firstSplitPos + defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - firstSplitPos + defaultSpacing / 2) <= 2);
Assert.IsTrue(Math.Abs(zones[1].Rect.Top - firstSplitPos - defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[1].Rect.Top - firstSplitPos - defaultSpacing / 2) <= 2);
Assert.AreEqual(zones[3].Rect.Bottom, Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing); Assert.AreEqual(Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing, zones[3].Rect.Bottom);
//create second split //create second split
int secondSplitPos = zones[3].Rect.Y + zones[3].Rect.Height / 2; int secondSplitPos = zones[3].Rect.Y + zones[3].Rect.Height / 2;
@ -216,14 +216,14 @@ namespace PowerToysTests
Assert.AreEqual(5, zones.Count); Assert.AreEqual(5, zones.Count);
//check first split on same position //check first split on same position
Assert.AreEqual(zones[0].Rect.Top, defaultSpacing); Assert.AreEqual(defaultSpacing, zones[0].Rect.Top);
Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - firstSplitPos + defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[0].Rect.Bottom - firstSplitPos + defaultSpacing / 2) <= 2);
//check second split //check second split
Assert.AreEqual(zones[3].Rect.Top, expectedTop); Assert.AreEqual(expectedTop, zones[3].Rect.Top);
Assert.IsTrue(Math.Abs(zones[3].Rect.Bottom - secondSplitPos + defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[3].Rect.Bottom - secondSplitPos + defaultSpacing / 2) <= 2);
Assert.IsTrue(Math.Abs(zones[4].Rect.Top - secondSplitPos - defaultSpacing / 2) <= 2); Assert.IsTrue(Math.Abs(zones[4].Rect.Top - secondSplitPos - defaultSpacing / 2) <= 2);
Assert.AreEqual(zones[4].Rect.Bottom, Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing); Assert.AreEqual(Screen.PrimaryScreen.Bounds.Bottom - defaultSpacing, zones[4].Rect.Bottom);
} }
[TestMethod] [TestMethod]