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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Testably.Abstractions.Helpers;
#else
[Obsolete("Will be removed in a future version!")]
#endif
[ExcludeFromCodeCoverage]
public abstract class PathSystemBase : IPath
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public IFileSystem FileSystem

/// <inheritdoc cref="IDirectoryInfoFactory.FromDirectoryName(string)" />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDirectoryInfo FromDirectoryName(string directoryName)
{
using IDisposable registration = RegisterMethod(nameof(FromDirectoryName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public IFileSystem FileSystem

/// <inheritdoc cref="IDriveInfoFactory.FromDriveName(string)" />
[Obsolete("Use `IDriveInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IDriveInfo FromDriveName(string driveName)
{
using IDisposable registration = RegisterMethod(nameof(FromDriveName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public IFileSystem FileSystem

/// <inheritdoc cref="IFileInfoFactory.FromFileName(string)" />
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
[ExcludeFromCodeCoverage]
public IFileInfo FromFileName(string fileName)
{
using IDisposable registration = RegisterMethod(nameof(FromFileName),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Testably.Abstractions.Testing.Helpers;
using Testably.Abstractions.Testing.Statistics;
#if NET6_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace Testably.Abstractions.Testing.FileSystem;

Expand All @@ -29,28 +27,33 @@ public IFileSystem 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)
Expand All @@ -59,47 +62,55 @@ public Stream Create(string path, FileMode mode, FileAccess access, FileShare sh
/// <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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ public IFileSystem 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public string GetRelativePath(string relativeTo, string path)
#if !NETSTANDARD2_0
[Obsolete(
"Insecure temporary file creation methods should not be used. Use `Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())` instead.")]
[ExcludeFromCodeCoverage]
#endif
public string GetTempFileName()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal DirectoryInfoFactory(RealFileSystem fileSystem)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal DriveInfoFactory(RealFileSystem fileSystem)

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

Expand Down
1 change: 1 addition & 0 deletions Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal FileInfoFactory(RealFileSystem fileSystem)

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

Expand Down
17 changes: 14 additions & 3 deletions Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.IO;
#if NET6_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif
using System.IO;

namespace Testably.Abstractions.FileSystem;

Expand All @@ -21,21 +19,25 @@ internal FileStreamFactory(RealFileSystem 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,
Expand All @@ -47,6 +49,7 @@ public Stream Create(
/// <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,
Expand All @@ -59,6 +62,7 @@ public Stream Create(
/// <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,
Expand All @@ -70,40 +74,47 @@ public Stream Create(

/// <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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ internal FileSystemWatcherFactory(RealFileSystem 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);

Expand Down
1 change: 1 addition & 0 deletions Source/Testably.Abstractions/FileSystem/PathWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public string GetRelativePath(string relativeTo, string path)
#if !NETSTANDARD2_0
[Obsolete(
"Insecure temporary file creation methods should not be used. Use `Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())` instead.")]
[ExcludeFromCodeCoverage]
#endif
public string GetTempFileName()
=> Path.GetTempFileName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Testably.Abstractions.Helpers
void StoreMetadata<T>(string key, T? value);
bool TryGetWrappedInstance<T>([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance);
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Obsolete("Will be removed in a future version!")]
public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Testably.Abstractions.Helpers
void StoreMetadata<T>(string key, T? value);
bool TryGetWrappedInstance<T>([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance);
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Obsolete("Will be removed in a future version!")]
public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Testably.Abstractions.Helpers
void StoreMetadata<T>(string key, T? value);
bool TryGetWrappedInstance<T>([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance);
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Obsolete("Will be removed in a future version!")]
public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Testably.Abstractions.Helpers
void StoreMetadata<T>(string key, T? value);
bool TryGetWrappedInstance<T>([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance);
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Obsolete]
public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Testably.Abstractions.Helpers
void StoreMetadata<T>(string key, T? value);
bool TryGetWrappedInstance<T>([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance);
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Obsolete("Will be removed in a future version!")]
public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath
{
Expand Down