diff --git a/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj b/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj
index 4611541e1134..bf30015f006e 100644
--- a/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj
+++ b/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/src/modules/Hosts/Hosts.Tests/HostsServiceTest.cs b/src/modules/Hosts/Hosts.Tests/HostsServiceTest.cs
index b3d032ca29cc..1de3d52bc2bb 100644
--- a/src/modules/Hosts/Hosts.Tests/HostsServiceTest.cs
+++ b/src/modules/Hosts/Hosts.Tests/HostsServiceTest.cs
@@ -2,13 +2,13 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Collections.Generic;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using System.Threading.Tasks;
using Hosts.Helpers;
using Hosts.Models;
using Hosts.Settings;
+using Hosts.Tests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Settings.UI.Library.Enumerations;
@@ -30,13 +30,8 @@ public static void ClassInitialize(TestContext context)
[TestMethod]
public void Hosts_Exists()
{
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
fileSystem.AddFile(service.HostsFilePath, new MockFileData(string.Empty));
var result = service.Exists();
@@ -47,15 +42,8 @@ public void Hosts_Exists()
[TestMethod]
public void Hosts_Not_Exists()
{
- var fileSystem = new MockFileSystem(new Dictionary
- {
- })
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
var result = service.Exists();
@@ -76,13 +64,8 @@ 10.1.1.2 host2 host2.local # another comment
# 10.1.1.30 host30 host30.local # new entry
";
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
fileSystem.AddFile(service.HostsFilePath, new MockFileData(content));
@@ -106,13 +89,8 @@ 10.1.1.2 host2 host2.local # another comment
@"10.1.1.2 host2 host2.local # another comment
";
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
fileSystem.AddFile(service.HostsFilePath, new MockFileData(content));
@@ -137,13 +115,8 @@ 10.1.1.2 host2 host2.local # another comment
10.1.1.2 host2 host2.local # another comment
";
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
fileSystem.AddFile(service.HostsFilePath, new MockFileData(content));
@@ -162,11 +135,7 @@ 10.1.1.2 host2 host2.local # another comment
[TestMethod]
public async Task Empty_Hosts()
{
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
@@ -197,14 +166,9 @@ 10.1.1.1 host host.local # comment
10.1.1.2 host2 host2.local # another comment
";
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
userSettings.Setup(m => m.AdditionalLinesPosition).Returns(AdditionalLinesPosition.Top);
-
var service = new HostsService(fileSystem, userSettings.Object, _elevationHelper.Object);
fileSystem.AddFile(service.HostsFilePath, new MockFileData(content));
@@ -234,11 +198,7 @@ 10.1.1.2 host2 host2.local # another comment
# footer
";
- var fileSystem = new MockFileSystem
- {
- FileSystemWatcher = new TestFileSystemWatcherFactory(),
- };
-
+ var fileSystem = new CustomMockFileSystem();
var userSettings = new Mock();
userSettings.Setup(m => m.AdditionalLinesPosition).Returns(AdditionalLinesPosition.Bottom);
diff --git a/src/modules/Hosts/Hosts.Tests/Mocks/CustomMockFileSystem.cs b/src/modules/Hosts/Hosts.Tests/Mocks/CustomMockFileSystem.cs
new file mode 100644
index 000000000000..325fc3fb1bcf
--- /dev/null
+++ b/src/modules/Hosts/Hosts.Tests/Mocks/CustomMockFileSystem.cs
@@ -0,0 +1,20 @@
+// Copyright (c) Microsoft Corporation
+// The Microsoft Corporation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.IO.Abstractions;
+using System.IO.Abstractions.TestingHelpers;
+
+namespace Hosts.Tests.Mocks
+{
+ public class CustomMockFileSystem : MockFileSystem
+ {
+ public override IFileSystemWatcherFactory FileSystemWatcher { get; }
+
+ public CustomMockFileSystem()
+ : base()
+ {
+ FileSystemWatcher = new MockFileSystemWatcherFactory();
+ }
+ }
+}
diff --git a/src/modules/Hosts/Hosts.Tests/TestFileSystemWatcher.cs b/src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcher.cs
similarity index 71%
rename from src/modules/Hosts/Hosts.Tests/TestFileSystemWatcher.cs
rename to src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcher.cs
index 050c931cfa03..0cbabd217b63 100644
--- a/src/modules/Hosts/Hosts.Tests/TestFileSystemWatcher.cs
+++ b/src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcher.cs
@@ -2,13 +2,14 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.IO.Abstractions;
-namespace Hosts.Tests
+namespace Hosts.Tests.Mocks
{
- public class TestFileSystemWatcher : FileSystemWatcherBase
+ public class MockFileSystemWatcher : FileSystemWatcherBase
{
public override bool IncludeSubdirectories { get; set; }
@@ -26,13 +27,15 @@ public class TestFileSystemWatcher : FileSystemWatcherBase
public override ISynchronizeInvoke SynchronizingObject { get; set; }
- public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType) => default(WaitForChangedResult);
+ public override Collection Filters => throw new System.NotImplementedException();
- public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout) => default(WaitForChangedResult);
+ public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType) => default;
- public TestFileSystemWatcher(string path) => Path = path;
+ public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout) => default;
- public TestFileSystemWatcher(string path, string filter)
+ public MockFileSystemWatcher(string path) => Path = path;
+
+ public MockFileSystemWatcher(string path, string filter)
{
Path = path;
Filter = filter;
diff --git a/src/modules/Hosts/Hosts.Tests/TestFileSystemWatcherFactory.cs b/src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcherFactory.cs
similarity index 54%
rename from src/modules/Hosts/Hosts.Tests/TestFileSystemWatcherFactory.cs
rename to src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcherFactory.cs
index cb62129cfcdd..3e0b4de140b4 100644
--- a/src/modules/Hosts/Hosts.Tests/TestFileSystemWatcherFactory.cs
+++ b/src/modules/Hosts/Hosts.Tests/Mocks/MockFileSystemWatcherFactory.cs
@@ -4,16 +4,16 @@
using System.IO.Abstractions;
-namespace Hosts.Tests
+namespace Hosts.Tests.Mocks
{
- public class TestFileSystemWatcherFactory : IFileSystemWatcherFactory
+ public class MockFileSystemWatcherFactory : IFileSystemWatcherFactory
{
- public IFileSystemWatcher CreateNew() => new TestFileSystemWatcher(null);
+ public IFileSystemWatcher CreateNew() => new MockFileSystemWatcher(null);
- public IFileSystemWatcher CreateNew(string path) => new TestFileSystemWatcher(path);
+ public IFileSystemWatcher CreateNew(string path) => new MockFileSystemWatcher(path);
- public IFileSystemWatcher CreateNew(string path, string filter) => new TestFileSystemWatcher(path, filter);
+ public IFileSystemWatcher CreateNew(string path, string filter) => new MockFileSystemWatcher(path, filter);
- public IFileSystemWatcher FromPath(string path) => new TestFileSystemWatcher(path);
+ public IFileSystemWatcher FromPath(string path) => new MockFileSystemWatcher(path);
}
}
diff --git a/src/modules/Hosts/Hosts/Hosts.csproj b/src/modules/Hosts/Hosts/Hosts.csproj
index 5aba83637308..9a4385c918f1 100644
--- a/src/modules/Hosts/Hosts/Hosts.csproj
+++ b/src/modules/Hosts/Hosts/Hosts.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj
index 675e47ce1bac..c0c29cd1841c 100644
--- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj
+++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj
@@ -43,7 +43,7 @@
-
+
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
index dbf04291b26f..8bb4c15cb73e 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
@@ -48,7 +48,7 @@
-
+
diff --git a/src/modules/imageresizer/tests/ImageResizerUITest.csproj b/src/modules/imageresizer/tests/ImageResizerUITest.csproj
index 47ef9ae22de5..ecce5e00efcd 100644
--- a/src/modules/imageresizer/tests/ImageResizerUITest.csproj
+++ b/src/modules/imageresizer/tests/ImageResizerUITest.csproj
@@ -54,7 +54,7 @@
-
+
diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj
index 7b711821921b..16dc6effa4e0 100644
--- a/src/modules/imageresizer/ui/ImageResizerUI.csproj
+++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj
@@ -48,7 +48,7 @@
- 12.2.5
+ 17.2.3
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs
index ee638cbeffb6..265ec1024699 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using Microsoft.Plugin.Folder.Sources;
@@ -31,7 +32,7 @@ public void SetupMock()
{ @"c:\Test\b\", new MockDirectoryData() },
});
- _queryFileSystemInfoMock = new QueryFileSystemInfo(_fileSystem.DirectoryInfo);
+ _queryFileSystemInfoMock = new QueryFileSystemInfo(_fileSystem.DirectoryInfo, MatchType.Simple, FileAttributes.Hidden | FileAttributes.System);
}
[TestMethod]
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj
index b290eefd22ae..996aafb94a68 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
index bcab8d0db2f9..c678d3838bf0 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
@@ -54,7 +54,7 @@
-
+
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryFileSystemInfo.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryFileSystemInfo.cs
index 950b6d9ee71d..b67a329c84db 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryFileSystemInfo.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryFileSystemInfo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation
+// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -12,23 +12,27 @@ namespace Microsoft.Plugin.Folder.Sources
public class QueryFileSystemInfo : IQueryFileSystemInfo
{
private readonly IDirectoryInfoFactory _directoryInfoFactory;
+ private readonly MatchType _matchType;
+ private readonly FileAttributes _attributesToSkip;
- public QueryFileSystemInfo(IDirectoryInfoFactory directoryInfoFactory)
+ public QueryFileSystemInfo(IDirectoryInfoFactory directoryInfoFactory, MatchType matchType = MatchType.Win32, FileAttributes attributesToSkip = FileAttributes.Hidden)
{
_directoryInfoFactory = directoryInfoFactory;
+ _matchType = matchType;
+ _attributesToSkip = attributesToSkip;
}
public IEnumerable MatchFileSystemInfo(string search, string incompleteName, bool isRecursive)
{
// search folder and add results
var directoryInfo = _directoryInfoFactory.FromDirectoryName(search);
- var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(incompleteName, new EnumerationOptions()
+ var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(incompleteName, new EnumerationOptions
{
- MatchType = MatchType.Win32,
+ MatchType = _matchType,
RecurseSubdirectories = isRecursive,
IgnoreInaccessible = true,
ReturnSpecialDirectories = false,
- AttributesToSkip = FileAttributes.Hidden,
+ AttributesToSkip = _attributesToSkip,
MatchCasing = MatchCasing.PlatformDefault,
});
diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
index dd04d324a365..f0082bc01317 100644
--- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
+++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
@@ -44,7 +44,7 @@
-
+
\ No newline at end of file
diff --git a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj
index 3603a4927d61..95c9eb312a63 100644
--- a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj
+++ b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj
@@ -32,7 +32,7 @@
-
+
diff --git a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj
index a7e34e4fb736..c55662d7544c 100644
--- a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj
+++ b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj
@@ -41,7 +41,7 @@
-
+
diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj
index 36bd528164be..a0b69f9b092c 100644
--- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj
+++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj
@@ -28,7 +28,7 @@
-
+
diff --git a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj
index 1a1883e2a39f..18f18add35cc 100644
--- a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj
+++ b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj
@@ -32,7 +32,7 @@
-
+
diff --git a/src/modules/previewpane/common/PreviewHandlerCommon.csproj b/src/modules/previewpane/common/PreviewHandlerCommon.csproj
index ce58cb40986e..beb44727cd3a 100644
--- a/src/modules/previewpane/common/PreviewHandlerCommon.csproj
+++ b/src/modules/previewpane/common/PreviewHandlerCommon.csproj
@@ -27,6 +27,6 @@
-
+
\ No newline at end of file
diff --git a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
index c076e7f5d476..08f857313fa7 100644
--- a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
+++ b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
@@ -25,7 +25,7 @@
-
+
diff --git a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
index ade0f6a92ee7..7021b458f489 100644
--- a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
+++ b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
@@ -28,7 +28,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+