[Deps]Upgrade System.IO.Abstractions (#35656)

* Upgrade System.IO.Abstractions to the latest stable release
This commit is contained in:
Davide Giacometti
2024-11-11 10:42:40 +01:00
committed by GitHub
parent 3d306f6177
commit 2ea9d56129
22 changed files with 70 additions and 53 deletions

View File

@@ -276,7 +276,7 @@ namespace Hosts.Tests
service.RemoveReadOnlyAttribute();
var readOnly = fileSystem.FileInfo.FromFileName(service.HostsFilePath).Attributes.HasFlag(FileAttributes.ReadOnly);
var readOnly = fileSystem.FileInfo.New(service.HostsFilePath).Attributes.HasFlag(FileAttributes.ReadOnly);
Assert.IsFalse(readOnly);
}
@@ -295,7 +295,7 @@ namespace Hosts.Tests
await service.WriteAsync("# Empty hosts file", Enumerable.Empty<Entry>());
var hidden = fileSystem.FileInfo.FromFileName(service.HostsFilePath).Attributes.HasFlag(FileAttributes.Hidden);
var hidden = fileSystem.FileInfo.New(service.HostsFilePath).Attributes.HasFlag(FileAttributes.Hidden);
Assert.IsTrue(hidden);
}
}

View File

@@ -2,6 +2,7 @@
// 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;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
@@ -9,7 +10,7 @@ using System.IO.Abstractions;
namespace Hosts.Tests.Mocks
{
public class MockFileSystemWatcher : FileSystemWatcherBase
public partial class MockFileSystemWatcher : FileSystemWatcherBase
{
public override bool IncludeSubdirectories { get; set; }
@@ -27,26 +28,35 @@ namespace Hosts.Tests.Mocks
public override ISynchronizeInvoke SynchronizingObject { get; set; }
public override Collection<string> Filters => throw new System.NotImplementedException();
public override Collection<string> Filters => throw new NotImplementedException();
public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType) => default;
public override IFileSystem FileSystem => throw new NotImplementedException();
public override WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout) => default;
public override IContainer Container => throw new NotImplementedException();
public MockFileSystemWatcher(string path) => Path = path;
public override void BeginInit() => throw new NotImplementedException();
public override void EndInit() => throw new NotImplementedException();
public override IWaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, TimeSpan timeout) => throw new NotImplementedException();
public override IWaitForChangedResult WaitForChanged(WatcherChangeTypes changeType) => throw new NotImplementedException();
public override IWaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout) => throw new NotImplementedException();
public MockFileSystemWatcher()
{
}
public MockFileSystemWatcher(string path)
{
Path = path;
}
public MockFileSystemWatcher(string path, string filter)
{
Path = path;
Filter = filter;
}
public override void BeginInit()
{
}
public override void EndInit()
{
}
}
}

View File

@@ -2,18 +2,22 @@
// 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;
using System.IO;
using System.IO.Abstractions;
namespace Hosts.Tests.Mocks
{
public class MockFileSystemWatcherFactory : IFileSystemWatcherFactory
{
public IFileSystemWatcher CreateNew() => new MockFileSystemWatcher(null);
public IFileSystem FileSystem => throw new NotImplementedException();
public IFileSystemWatcher CreateNew(string path) => new MockFileSystemWatcher(path);
public IFileSystemWatcher New() => new MockFileSystemWatcher();
public IFileSystemWatcher CreateNew(string path, string filter) => new MockFileSystemWatcher(path, filter);
public IFileSystemWatcher New(string path) => new MockFileSystemWatcher(path);
public IFileSystemWatcher FromPath(string path) => new MockFileSystemWatcher(path);
public IFileSystemWatcher New(string path, string filter) => new MockFileSystemWatcher(path, filter);
public IFileSystemWatcher Wrap(FileSystemWatcher fileSystemWatcher) => throw new NotImplementedException();
}
}