diff --git a/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj b/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj
index 4611541e11..bf30015f00 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 b3d032ca29..1de3d52bc2 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 @@ namespace Hosts.Tests
[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 @@ namespace Hosts.Tests
[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 @@ namespace Hosts.Tests
# 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 @@ namespace Hosts.Tests
@"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 @@ namespace Hosts.Tests
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 @@ namespace Hosts.Tests
[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 @@ namespace Hosts.Tests
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 @@ namespace Hosts.Tests
# 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 0000000000..325fc3fb1b
--- /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 050c931cfa..0cbabd217b 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 @@ namespace Hosts.Tests
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 cb62129cfc..3e0b4de140 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 a94806c0db..e87eecde66 100644
--- a/src/modules/Hosts/Hosts/Hosts.csproj
+++ b/src/modules/Hosts/Hosts/Hosts.csproj
@@ -37,7 +37,7 @@
-
+
diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj
index 675e47ce1b..c0c29cd184 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 dbf04291b2..8bb4c15cb7 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 47ef9ae22d..ecce5e00ef 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 7b71182192..16dc6effa4 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 ee638cbeff..265ec10246 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 @@ namespace Microsoft.Plugin.Folder.UnitTests
{ @"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 b290eefd22..996aafb94a 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 bcab8d0db2..c678d3838b 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 950b6d9ee7..b67a329c84 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 dd04d324a3..f0082bc013 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 3603a4927d..95c9eb312a 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 a7e34e4fb7..c55662d754 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 36bd528164..a0b69f9b09 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 1a1883e2a3..18f18add35 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 ce58cb4098..beb44727cd 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 c076e7f5d4..08f857313f 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 ade0f6a92e..7021b458f4 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
-
+