Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ItemGroup>
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
<PackageVersion Include="TestableIO.System.IO.Abstractions" Version="20.0.34" />
<PackageVersion Include="TestableIO.System.IO.Abstractions" Version="21.0.2" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ internal DirectoryInfoFactoryMock(MockFileSystem fileSystem)
public IFileSystem FileSystem
=> _fileSystem;

/// <inheritdoc cref="IDirectoryInfoFactory.FromDirectoryName(string)" />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDirectoryInfo FromDirectoryName(string directoryName)
{
using IDisposable registration = RegisterMethod(nameof(FromDirectoryName),
directoryName);

return New(directoryName);
}

/// <inheritdoc cref="IDirectoryInfoFactory.New(string)" />
public IDirectoryInfo New(string path)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ internal DriveInfoFactoryMock(MockFileSystem fileSystem)
public IFileSystem FileSystem
=> _fileSystem;

/// <inheritdoc cref="IDriveInfoFactory.FromDriveName(string)" />
[Obsolete("Use `IDriveInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDriveInfo FromDriveName(string driveName)
{
using IDisposable registration = RegisterMethod(nameof(FromDriveName),
driveName);

return New(driveName);
}

/// <inheritdoc cref="IDriveInfoFactory.GetDrives()" />
public IDriveInfo[] GetDrives()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ internal FileInfoFactoryMock(MockFileSystem fileSystem)
public IFileSystem FileSystem
=> _fileSystem;

/// <inheritdoc cref="IFileInfoFactory.FromFileName(string)" />
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IFileInfo FromFileName(string fileName)
{
using IDisposable registration = RegisterMethod(nameof(FromFileName),
fileName);

return New(fileName);
}

/// <inheritdoc cref="IFileInfoFactory.New(string)" />
public IFileInfo New(string fileName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,96 +25,6 @@ internal FileStreamFactoryMock(MockFileSystem fileSystem)
public IFileSystem FileSystem
=> _fileSystem;

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode)
=> New(path, mode);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access)
=> New(path, mode, access);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share)
=> New(path, mode, access, share);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share,
int bufferSize)
=> New(path, mode, access, share, bufferSize);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int, FileOptions)" />
[Obsolete(
"Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, FileOptions)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share,
int bufferSize,
FileOptions options)
=> New(path, mode, access, share, bufferSize, options);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int, bool)" />
[Obsolete(
"Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, bool)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share,
int bufferSize,
bool useAsync)
=> New(path, mode, access, share, bufferSize, useAsync);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access)
=> New(handle, access);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess, int)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize)
=> New(handle, access, bufferSize);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess, int, bool)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int, bool)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
=> New(handle, access, bufferSize, isAsync);

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool, int)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess, int) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool, int, bool)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess, int, bool) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize,
bool isAsync)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.New(string, FileMode)" />
public FileSystemStream New(string path, FileMode mode)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ internal FileSystemWatcherFactoryMock(MockFileSystem fileSystem)
public IFileSystem FileSystem
=> _fileSystem;

/// <inheritdoc cref="IFileSystemWatcherFactory.CreateNew()" />
[Obsolete("Use `IFileSystemWatcherFactory.New()` instead")]
[ExcludeFromCodeCoverage]
public IFileSystemWatcher CreateNew()
=> New();

/// <inheritdoc cref="IFileSystemWatcherFactory.CreateNew(string)" />
[Obsolete("Use `IFileSystemWatcherFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IFileSystemWatcher CreateNew(string path)
=> New(path);

/// <inheritdoc cref="IFileSystemWatcherFactory.CreateNew(string, string)" />
[Obsolete("Use `IFileSystemWatcherFactory.New(string, string)` instead")]
[ExcludeFromCodeCoverage]
public IFileSystemWatcher CreateNew(string path, string filter)
=> New(path, filter);

/// <inheritdoc cref="IFileSystemWatcherFactory.New()" />
public IFileSystemWatcher New()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.IO;

namespace Testably.Abstractions.FileSystem;
Expand All @@ -16,12 +15,6 @@ internal DirectoryInfoFactory(RealFileSystem fileSystem)
/// <inheritdoc cref="IFileSystemEntity.FileSystem" />
public IFileSystem FileSystem { get; }

/// <inheritdoc cref="IDirectoryInfoFactory.FromDirectoryName(string)" />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDirectoryInfo FromDirectoryName(string directoryName)
=> New(directoryName);

/// <inheritdoc cref="IDirectoryInfoFactory.New(string)" />
public IDirectoryInfo New(string path)
=> DirectoryInfoWrapper.FromDirectoryInfo(
Expand Down
9 changes: 1 addition & 8 deletions Source/Testably.Abstractions/FileSystem/DriveInfoFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;

Expand All @@ -17,12 +16,6 @@ internal DriveInfoFactory(RealFileSystem fileSystem)
/// <inheritdoc cref="IFileSystemEntity.FileSystem" />
public IFileSystem FileSystem { get; }

/// <inheritdoc cref="IDriveInfoFactory.FromDriveName(string)" />
[Obsolete("Use `IDriveInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDriveInfo FromDriveName(string driveName)
=> New(driveName);

/// <inheritdoc cref="IDriveInfoFactory.GetDrives()" />
public IDriveInfo[] GetDrives()
=> DriveInfo.GetDrives()
Expand Down
9 changes: 1 addition & 8 deletions Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.IO;

namespace Testably.Abstractions.FileSystem;
Expand All @@ -16,12 +15,6 @@ internal FileInfoFactory(RealFileSystem fileSystem)
/// <inheritdoc cref="IFileSystemEntity.FileSystem" />
public IFileSystem FileSystem { get; }

/// <inheritdoc cref="IFileInfoFactory.FromFileName(string)" />
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IFileInfo FromFileName(string fileName)
=> New(fileName);

/// <inheritdoc cref="IFileInfoFactory.New(string)" />
public IFileInfo New(string fileName)
=> FileInfoWrapper.FromFileInfo(
Expand Down
111 changes: 3 additions & 108 deletions Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
#if NET6_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace Testably.Abstractions.FileSystem;

Expand All @@ -17,112 +18,6 @@ internal FileStreamFactory(RealFileSystem fileSystem)
/// <inheritdoc cref="IFileSystemEntity.FileSystem" />
public IFileSystem FileSystem { get; }

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode)
=> New(path, mode);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access)
=> New(path, mode, access);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share)
=> New(path, mode, access, share);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int)" />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(
string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize)
=> New(path, mode, access, share, bufferSize);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int, FileOptions)" />
[Obsolete(
"Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, FileOptions)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(
string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize,
FileOptions options)
=> New(path, mode, access, share, bufferSize, options);

/// <inheritdoc cref="IFileStreamFactory.Create(string, FileMode, FileAccess, FileShare, int, bool)" />
[Obsolete(
"Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, bool)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(
string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize,
bool useAsync)
=> New(path, mode, access, share, bufferSize, useAsync);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access)
=> New(handle, access);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess, int)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize)
=> New(handle, access, bufferSize);

/// <inheritdoc cref="IFileStreamFactory.Create(SafeFileHandle, FileAccess, int, bool)" />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int, bool)` instead")]
[ExcludeFromCodeCoverage]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
=> New(handle, access, bufferSize, isAsync);

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool, int)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess, int) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.Create(IntPtr, FileAccess, bool, int, bool)" />
[Obsolete(
"This method has been deprecated. Please use New(SafeFileHandle, FileAccess, int, bool) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[ExcludeFromCodeCoverage]
public Stream Create(
IntPtr handle,
FileAccess access,
bool ownsHandle,
int bufferSize,
bool isAsync)
=> throw new NotImplementedException();

/// <inheritdoc cref="IFileStreamFactory.New(string, FileMode)" />
public FileSystemStream New(string path, FileMode mode)
=> Wrap(new FileStream(path, mode));
Expand Down
Loading