From 1c267a55d5eab0262167c251c5a2d766993eeae6 Mon Sep 17 00:00:00 2001 From: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com> Date: Fri, 26 Jun 2020 11:44:51 -0700 Subject: [PATCH] Changing test structure. Need to add unit tests. --- .../Programs/PackageCatalogWrapperTests.cs | 10 ---------- .../Storage/PackageRepositoryTest.cs | 10 ++++++++++ .../Storage/IProgramRepository.cs | 11 +++++++++++ .../Storage/PackageRepository.cs | 6 +++--- 4 files changed, 24 insertions(+), 13 deletions(-) delete mode 100644 src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/PackageCatalogWrapperTests.cs create mode 100644 src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Storage/PackageRepositoryTest.cs create mode 100644 src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/IProgramRepository.cs diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/PackageCatalogWrapperTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/PackageCatalogWrapperTests.cs deleted file mode 100644 index 5bc2428780..0000000000 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/PackageCatalogWrapperTests.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Microsoft.Plugin.Program.UnitTests.Programs -{ - class PackageCatalogWrapperTests - { - } -} diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Storage/PackageRepositoryTest.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Storage/PackageRepositoryTest.cs new file mode 100644 index 0000000000..23b30552af --- /dev/null +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Storage/PackageRepositoryTest.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Plugin.Program.UnitTests.Storage +{ + class PackageRepositoryTest + { + } +} diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/IProgramRepository.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/IProgramRepository.cs new file mode 100644 index 0000000000..357aee5760 --- /dev/null +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/IProgramRepository.cs @@ -0,0 +1,11 @@ +using Windows.ApplicationModel; + +namespace Microsoft.Plugin.Program.Storage +{ + internal interface IProgramRepository + { + void IndexPrograms(); + void Load(); + void Save(); + } +} \ No newline at end of file diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/PackageRepository.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/PackageRepository.cs index f8cd2829d9..0000e8d4b7 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/PackageRepository.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/PackageRepository.cs @@ -14,7 +14,7 @@ namespace Microsoft.Plugin.Program.Storage /// A repository for storing packaged applications such as UWP apps or appx packaged desktop apps. /// This repository will also monitor for changes to the PackageCatelog and update the repository accordingly /// - internal class PackageRepository : ListRepository, IRepository + internal class PackageRepository : ListRepository, IRepository, IProgramRepository { IPackageCatalog _packageCatalog; public PackageRepository(IPackageCatalog packageCatalog, IStorage> storage) : base(storage) @@ -42,7 +42,7 @@ namespace Microsoft.Plugin.Program.Storage //Note there are sometimes multiple packages per application and this doesn't necessarily mean that we haven't found the app. //eg. "Could not find file 'C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminalPreview_2020.616.45.0_neutral_~_8wekyb3d8bbwe\\AppxManifest.xml'." - catch ( System.IO.FileNotFoundException e) + catch (System.IO.FileNotFoundException e) { ProgramLogger.LogException($"|UWP|OnPackageInstalling|{args.Package.InstalledLocation}|{e.Message}", e); } @@ -56,7 +56,7 @@ namespace Microsoft.Plugin.Program.Storage //find apps associated with this package. var uwp = new UWP(args.Package); var apps = _items.Where(a => a.Package.Equals(uwp)).ToArray(); - foreach(var app in apps) + foreach (var app in apps) { Remove(app); }