Adding FxCop to Program Plugin Unit Tests (#5884)

* Adding FxCop to Microsoft.Plugin.Program.UnitTests

* CA1707: Identifiers should not contain underscores
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1707?view=vs-2019

* CA1307: Specify StringComparison
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1307?view=vs-2019

* CA1812: Avoid uninstantiated internal classes
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1812?view=vs-2019

* More CA1707: Identifiers should not contain underscores fixes now that class is public

* More fixes for https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1812?view=vs-2019

List Repository and Win32ProgramRepository

* More CA1707: Identifiers should not contain underscores fixes now that class is public

ListRepository and Win32ProgramRepository tests

* Adding `ConfigureAwait(false)` and removing Assert.DoesNotThrowAsync as thowing an exception will fail the test anyway, and the DoesNotThrowAsync method can't be awaited.

Fix for CA2007: Do not directly await a Task (Consider calling ConfigureAwait on the task).

CS1998 This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

* Setting treat warning as errors to true for release and debug.
This commit is contained in:
ryanbodrug-microsoft
2020-08-12 10:03:34 -07:00
committed by GitHub
parent a0832d3fb6
commit db6e9b6962
6 changed files with 60 additions and 54 deletions

View File

@@ -12,9 +12,19 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.14.5" /> <PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="nunit" Version="3.12.0" /> <PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />

View File

@@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace Microsoft.Plugin.Program.UnitTests.Programs namespace Microsoft.Plugin.Program.UnitTests.Programs
{ {
[TestFixture] [TestFixture]
class UWPTests public class UWPTests
{ {
static readonly PackageWrapper developmentModeApp = new PackageWrapper( static readonly PackageWrapper developmentModeApp = new PackageWrapper(
"DevelopmentApp", "DevelopmentApp",
@@ -37,7 +37,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
); );
[Test] [Test]
public void All_ShouldReturnPackagesWithDevelopmentMode_WhenCalled() public void AllShouldReturnPackagesWithDevelopmentModeWhenCalled()
{ {
// Arrange // Arrange
Main._settings = new ProgramPluginSettings(); Main._settings = new ProgramPluginSettings();
@@ -56,7 +56,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void All_ShouldNotReturnPackageFrameworks_WhenCalled() public void AllShouldNotReturnPackageFrameworksWhenCalled()
{ {
// Arrange // Arrange
Main._settings = new ProgramPluginSettings(); Main._settings = new ProgramPluginSettings();
@@ -74,7 +74,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void PowerToysRun_ShouldNotAddInvalidApp_WhenIndexingUWPApplications() public void PowerToysRunShouldNotAddInvalidAppWhenIndexingUWPApplications()
{ {
// Arrange // Arrange
PackageWrapper invalidPackagedApp = new PackageWrapper(); PackageWrapper invalidPackagedApp = new PackageWrapper();

View File

@@ -8,6 +8,8 @@ using Wox.Plugin;
using Microsoft.Plugin.Program; using Microsoft.Plugin.Program;
using System.IO.Packaging; using System.IO.Packaging;
using Windows.ApplicationModel; using Windows.ApplicationModel;
using System;
namespace Microsoft.Plugin.Program.UnitTests.Programs namespace Microsoft.Plugin.Program.UnitTests.Programs
{ {
using Win32Program = Microsoft.Plugin.Program.Programs.Win32Program; using Win32Program = Microsoft.Plugin.Program.Programs.Win32Program;
@@ -181,7 +183,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
}; };
[Test] [Test]
public void DedupFunction_whenCalled_mustRemoveDuplicateNotepads() public void DedupFunctionWhenCalledMustRemoveDuplicateNotepads()
{ {
// Arrange // Arrange
List<Win32Program> prgms = new List<Win32Program>(); List<Win32Program> prgms = new List<Win32Program>();
@@ -196,7 +198,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void DedupFunction_whenCalled_MustRemoveInternetShortcuts() public void DedupFunctionWhenCalledMustRemoveInternetShortcuts()
{ {
// Arrange // Arrange
List<Win32Program> prgms = new List<Win32Program>(); List<Win32Program> prgms = new List<Win32Program>();
@@ -211,7 +213,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void DedupFunction_whenCalled_mustNotRemovelnkWhichdoesNotHaveExe() public void DedupFunctionWhenCalledMustNotRemovelnkWhichdoesNotHaveExe()
{ {
// Arrange // Arrange
List<Win32Program> prgms = new List<Win32Program>(); List<Win32Program> prgms = new List<Win32Program>();
@@ -225,7 +227,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void DedupFunction_mustRemoveDuplicates_forExeExtensionsWithoutLnkResolvedPath() public void DedupFunctionMustRemoveDuplicatesForExeExtensionsWithoutLnkResolvedPath()
{ {
// Arrange // Arrange
List<Win32Program> prgms = new List<Win32Program>(); List<Win32Program> prgms = new List<Win32Program>();
@@ -241,7 +243,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void DedupFunction_mustNotRemovePrograms_withSameExeNameAndFullPath() public void DedupFunctionMustNotRemoveProgramsWithSameExeNameAndFullPath()
{ {
// Arrange // Arrange
List<Win32Program> prgms = new List<Win32Program>(); List<Win32Program> prgms = new List<Win32Program>();
@@ -257,7 +259,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void FunctionIsWebApplication_ShouldReturnTrue_ForWebApplications() public void FunctionIsWebApplicationShouldReturnTrueForWebApplications()
{ {
// The IsWebApplication(() function must return true for all PWAs and pinned web pages // The IsWebApplication(() function must return true for all PWAs and pinned web pages
Assert.IsTrue(twitter_pwa.IsWebApplication()); Assert.IsTrue(twitter_pwa.IsWebApplication());
@@ -269,7 +271,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[TestCase("ignore")] [TestCase("ignore")]
public void FunctionFilterWebApplication_ShouldReturnFalse_WhenSearchingForTheMainApp(string query) public void FunctionFilterWebApplicationShouldReturnFalseWhenSearchingForTheMainApp(string query)
{ {
// Irrespective of the query, the FilterWebApplication() Function must not filter main apps such as edge and chrome // Irrespective of the query, the FilterWebApplication() Function must not filter main apps such as edge and chrome
Assert.IsFalse(msedge.FilterWebApplication(query)); Assert.IsFalse(msedge.FilterWebApplication(query));
@@ -283,7 +285,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
[TestCase("edg", ExpectedResult = true)] [TestCase("edg", ExpectedResult = true)]
[TestCase("Edge page", ExpectedResult = false)] [TestCase("Edge page", ExpectedResult = false)]
[TestCase("Edge Web page", ExpectedResult = false)] [TestCase("Edge Web page", ExpectedResult = false)]
public bool EdgeWebSites_ShouldBeFiltered_WhenSearchingForEdge(string query) public bool EdgeWebSitesShouldBeFilteredWhenSearchingForEdge(string query)
{ {
return pinned_webpage.FilterWebApplication(query); return pinned_webpage.FilterWebApplication(query);
} }
@@ -293,7 +295,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
[TestCase("Google", ExpectedResult = true)] [TestCase("Google", ExpectedResult = true)]
[TestCase("Google Chrome", ExpectedResult = true)] [TestCase("Google Chrome", ExpectedResult = true)]
[TestCase("Google Chrome twitter", ExpectedResult = false)] [TestCase("Google Chrome twitter", ExpectedResult = false)]
public bool ChromeWebSites_ShouldBeFiltered_WhenSearchingForChrome(string query) public bool ChromeWebSitesShouldBeFilteredWhenSearchingForChrome(string query)
{ {
return twitter_pwa.FilterWebApplication(query); return twitter_pwa.FilterWebApplication(query);
} }
@@ -306,7 +308,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
[TestCase("WEB PAGE", 1, ExpectedResult = false)] [TestCase("WEB PAGE", 1, ExpectedResult = false)]
[TestCase("edge", 2, ExpectedResult = false)] [TestCase("edge", 2, ExpectedResult = false)]
[TestCase("EDGE", 2, ExpectedResult = false)] [TestCase("EDGE", 2, ExpectedResult = false)]
public bool PinnedWebPages_ShouldNotBeFiltered_WhenSearchingForThem(string query, int Case) public bool PinnedWebPagesShouldNotBeFilteredWhenSearchingForThem(string query, int Case)
{ {
const uint CASE_TWITTER = 0; const uint CASE_TWITTER = 0;
const uint CASE_WEB_PAGE = 1; const uint CASE_WEB_PAGE = 1;
@@ -334,7 +336,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
[TestCase("cmd")] [TestCase("cmd")]
[TestCase("cmd.exe")] [TestCase("cmd.exe")]
[TestCase("ignoreQueryText")] [TestCase("ignoreQueryText")]
public void Win32Applications_ShouldNotBeFiltered_WhenFilteringRunCommands(string query) public void Win32ApplicationsShouldNotBeFilteredWhenFilteringRunCommands(string query)
{ {
// Even if there is an exact match in the name or exe name, win32 applications should never be filtered // Even if there is an exact match in the name or exe name, win32 applications should never be filtered
Assert.IsTrue(command_prompt.QueryEqualsNameForRunCommands(query)); Assert.IsTrue(command_prompt.QueryEqualsNameForRunCommands(query));
@@ -343,7 +345,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
[TestCase("cmd")] [TestCase("cmd")]
[TestCase("Cmd")] [TestCase("Cmd")]
[TestCase("CMD")] [TestCase("CMD")]
public void RunCommands_ShouldNotBeFiltered_OnExactMatch(string query) public void RunCommandsShouldNotBeFilteredOnExactMatch(string query)
{ {
// Partial matches should be filtered as cmd is not equal to cmder // Partial matches should be filtered as cmd is not equal to cmder
Assert.IsFalse(cmder_run_command.QueryEqualsNameForRunCommands(query)); Assert.IsFalse(cmder_run_command.QueryEqualsNameForRunCommands(query));
@@ -353,7 +355,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void WEB_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled() public void WebApplicationShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
{ {
// Arrange // Arrange
var mock = new Mock<IPublicAPI>(); var mock = new Mock<IPublicAPI>();
@@ -370,7 +372,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void INTERNET_SHORTCUT_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled() public void InternetShortcutApplicationShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
{ {
// Arrange // Arrange
var mock = new Mock<IPublicAPI>(); var mock = new Mock<IPublicAPI>();
@@ -386,7 +388,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void WIN32_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled() public void Win32ApplicationShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
{ {
// Arrange // Arrange
var mock = new Mock<IPublicAPI>(); var mock = new Mock<IPublicAPI>();
@@ -403,7 +405,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void RUN_COMMAND_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled() public void RunCommandShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
{ {
// Arrange // Arrange
var mock = new Mock<IPublicAPI>(); var mock = new Mock<IPublicAPI>();
@@ -420,7 +422,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
} }
[Test] [Test]
public void Win32Apps_ShouldSetNameAsTitle_WhileCreatingResult() public void Win32AppsShouldSetNameAsTitleWhileCreatingResult()
{ {
var mock = new Mock<IPublicAPI>(); var mock = new Mock<IPublicAPI>();
mock.Setup(x => x.GetTranslation(It.IsAny<string>())).Returns(It.IsAny<string>()); mock.Setup(x => x.GetTranslation(It.IsAny<string>())).Returns(It.IsAny<string>());
@@ -430,8 +432,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
var result = cmder_run_command.Result("cmder", mock.Object); var result = cmder_run_command.Result("cmder", mock.Object);
// Assert // Assert
Assert.IsTrue(result.Title.Equals(cmder_run_command.Name)); Assert.IsTrue(result.Title.Equals(cmder_run_command.Name, StringComparison.Ordinal));
Assert.IsFalse(result.Title.Equals(cmder_run_command.Description)); Assert.IsFalse(result.Title.Equals(cmder_run_command.Description, StringComparison.Ordinal));
} }
} }
} }

View File

@@ -12,11 +12,11 @@ using Wox.Infrastructure.Storage;
namespace Microsoft.Plugin.Program.UnitTests.Storage namespace Microsoft.Plugin.Program.UnitTests.Storage
{ {
[TestFixture] [TestFixture]
class ListRepositoryTests public class ListRepositoryTests
{ {
[Test] [Test]
public void Contains_ShouldReturnTrue_WhenListIsInitializedWithItem() public void ContainsShouldReturnTrueWhenListIsInitializedWithItem()
{ {
//Arrange //Arrange
var itemName = "originalItem1"; var itemName = "originalItem1";
@@ -30,7 +30,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[Test] [Test]
public void Contains_ShouldReturnTrue_WhenListIsUpdatedWithAdd() public void ContainsShouldReturnTrueWhenListIsUpdatedWithAdd()
{ {
//Arrange //Arrange
IRepository<string> repository = new ListRepository<string>(); IRepository<string> repository = new ListRepository<string>();
@@ -45,7 +45,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[Test] [Test]
public void Contains_ShouldReturnFalse_WhenListIsUpdatedWithRemove() public void ContainsShouldReturnFalseWhenListIsUpdatedWithRemove()
{ {
//Arrange //Arrange
var itemName = "originalItem1"; var itemName = "originalItem1";
@@ -60,7 +60,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[Test] [Test]
public async Task Add_ShouldNotThrow_WhenBeingIterated() public async Task AddShouldNotThrowWhenBeingIterated()
{ {
//Arrange //Arrange
ListRepository<string> repository = new ListRepository<string>(); ListRepository<string> repository = new ListRepository<string>();
@@ -96,14 +96,11 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
}); });
//Assert that this does not throw. Collections that aren't syncronized will throw an invalidoperatioexception if the list is modified while enumerating //Assert that this does not throw. Collections that aren't syncronized will throw an invalidoperatioexception if the list is modified while enumerating
Assert.DoesNotThrowAsync(async () => await Task.WhenAll(new Task[] { iterationTask, addTask }).ConfigureAwait(false);
{
await Task.WhenAll(new Task[] { iterationTask, addTask });
});
} }
[Test] [Test]
public async Task Remove_ShouldNotThrow_WhenBeingIterated() public async Task RemoveShouldNotThrowWhenBeingIterated()
{ {
//Arrange //Arrange
ListRepository<string> repository = new ListRepository<string>(); ListRepository<string> repository = new ListRepository<string>();
@@ -139,10 +136,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
}); });
//Assert that this does not throw. Collections that aren't syncronized will throw an invalidoperatioexception if the list is modified while enumerating //Assert that this does not throw. Collections that aren't syncronized will throw an invalidoperatioexception if the list is modified while enumerating
Assert.DoesNotThrowAsync(async () => await Task.WhenAll(new Task[] { iterationTask, addTask }).ConfigureAwait(false);
{
await Task.WhenAll(new Task[] { iterationTask, addTask });
});
} }
} }
} }

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Microsoft.Plugin.Program.UnitTests.Storage namespace Microsoft.Plugin.Program.UnitTests.Storage
{ {
class PackageRepositoryTest public class PackageRepositoryTest
{ {
} }
} }

View File

@@ -16,7 +16,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
using Win32Program = Program.Programs.Win32Program; using Win32Program = Program.Programs.Win32Program;
[TestFixture] [TestFixture]
class Win32ProgramRepositoryTest public class Win32ProgramRepositoryTest
{ {
List<IFileSystemWatcherWrapper> _fileSystemWatchers; List<IFileSystemWatcherWrapper> _fileSystemWatchers;
ProgramPluginSettings _settings = new ProgramPluginSettings(); ProgramPluginSettings _settings = new ProgramPluginSettings();
@@ -37,7 +37,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("Name", "ExecutableName", "FullPath", "description1", "description2")] [TestCase("Name", "ExecutableName", "FullPath", "description1", "description2")]
public void Win32Repository_MustNotStoreDuplicates_WhileAddingItemsWithSameHashCode(string name, string exename, string fullPath, string description1, string description2) public void Win32RepositoryMustNotStoreDuplicatesWhileAddingItemsWithSameHashCode(string name, string exename, string fullPath, string description1, string description2)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -71,7 +71,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("path.appref-ms")] [TestCase("path.appref-ms")]
public void Win32ProgramRepository_MustCallOnAppCreatedForApprefApps_WhenCreatedEventIsRaised(string path) public void Win32ProgramRepositoryMustCallOnAppCreatedForApprefAppsWhenCreatedEventIsRaised(string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -86,7 +86,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "path.appref-ms")] [TestCase("directory", "path.appref-ms")]
public void Win32ProgramRepository_MustCallOnAppDeletedForApprefApps_WhenDeletedEventIsRaised(string directory, string path) public void Win32ProgramRepositoryMustCallOnAppDeletedForApprefAppsWhenDeletedEventIsRaised(string directory, string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -104,7 +104,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")] [TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")]
public void Win32ProgramRepository_MustCallOnAppRenamedForApprefApps_WhenRenamedEventIsRaised(string directory, string oldpath, string newpath) public void Win32ProgramRepositoryMustCallOnAppRenamedForApprefAppsWhenRenamedEventIsRaised(string directory, string oldpath, string newpath)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -127,7 +127,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("path.exe")] [TestCase("path.exe")]
public void Win32ProgramRepository_MustCallOnAppCreatedForExeApps_WhenCreatedEventIsRaised(string path) public void Win32ProgramRepositoryMustCallOnAppCreatedForExeAppsWhenCreatedEventIsRaised(string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -147,7 +147,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "path.exe")] [TestCase("directory", "path.exe")]
public void Win32ProgramRepository_MustCallOnAppDeletedForExeApps_WhenDeletedEventIsRaised(string directory, string path) public void Win32ProgramRepositoryMustCallOnAppDeletedForExeAppsWhenDeletedEventIsRaised(string directory, string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -170,7 +170,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")] [TestCase("directory", "oldpath.appref-ms", "newpath.appref-ms")]
public void Win32ProgramRepository_MustCallOnAppRenamedForExeApps_WhenRenamedEventIsRaised(string directory, string oldpath, string newpath) public void Win32ProgramRepositoryMustCallOnAppRenamedForExeAppsWhenRenamedEventIsRaised(string directory, string oldpath, string newpath)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -198,7 +198,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("path.url")] [TestCase("path.url")]
public void Win32ProgramRepository_MustCallOnAppChangedForUrlApps_WhenChangedEventIsRaised(string path) public void Win32ProgramRepositoryMustCallOnAppChangedForUrlAppsWhenChangedEventIsRaised(string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -218,7 +218,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("path.url")] [TestCase("path.url")]
public void Win32ProgramRepository_MustNotCreateUrlApp_WhenCreatedEventIsRaised(string path) public void Win32ProgramRepositoryMustNotCreateUrlAppWhenCreatedEventIsRaised(string path)
{ {
// We are handing internet shortcut apps using the Changed event instead // We are handing internet shortcut apps using the Changed event instead
@@ -241,7 +241,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
[TestCase("path.exe")] [TestCase("path.exe")]
[TestCase("path.lnk")] [TestCase("path.lnk")]
[TestCase("path.appref-ms")] [TestCase("path.appref-ms")]
public void Win32ProgramRepository_MustNotCreateAnyAppOtherThanUrlApp_WhenChangedEventIsRaised(string path) public void Win32ProgramRepositoryMustNotCreateAnyAppOtherThanUrlAppWhenChangedEventIsRaised(string path)
{ {
// We are handing internet shortcut apps using the Changed event instead // We are handing internet shortcut apps using the Changed event instead
@@ -267,7 +267,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "path.url")] [TestCase("directory", "path.url")]
public void Win32ProgramRepository_MustCallOnAppDeletedForUrlApps_WhenDeletedEventIsRaised(string directory, string path) public void Win32ProgramRepositoryMustCallOnAppDeletedForUrlAppsWhenDeletedEventIsRaised(string directory, string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -290,7 +290,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "oldpath.url", "newpath.url")] [TestCase("directory", "oldpath.url", "newpath.url")]
public void Win32ProgramRepository_MustCallOnAppRenamedForUrlApps_WhenRenamedEventIsRaised(string directory, string oldpath, string newpath) public void Win32ProgramRepositoryMustCallOnAppRenamedForUrlAppsWhenRenamedEventIsRaised(string directory, string oldpath, string newpath)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -319,7 +319,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
[TestCase("path.lnk")] [TestCase("path.lnk")]
public void Win32ProgramRepository_MustCallOnAppCreatedForLnkApps_WhenCreatedEventIsRaised(string path) public void Win32ProgramRepositoryMustCallOnAppCreatedForLnkAppsWhenCreatedEventIsRaised(string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -339,7 +339,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "path.lnk")] [TestCase("directory", "path.lnk")]
public void Win32ProgramRepository_MustCallOnAppDeletedForLnkApps_WhenDeletedEventIsRaised(string directory, string path) public void Win32ProgramRepositoryMustCallOnAppDeletedForLnkAppsWhenDeletedEventIsRaised(string directory, string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);
@@ -369,7 +369,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
} }
[TestCase("directory", "oldpath.lnk", "path.lnk")] [TestCase("directory", "oldpath.lnk", "path.lnk")]
public void Win32ProgramRepository_MustCallOnAppRenamedForLnkApps_WhenRenamedEventIsRaised(string directory, string oldpath, string path) public void Win32ProgramRepositoryMustCallOnAppRenamedForLnkAppsWhenRenamedEventIsRaised(string directory, string oldpath, string path)
{ {
// Arrange // Arrange
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch); Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32Program>>("Win32"), _settings, _pathsToWatch);