diff --git a/Directory.Packages.props b/Directory.Packages.props index 7b8d8a613..f04cf9e00 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + diff --git a/Source/Testably.Abstractions.Testing/FileSystem/DirectoryInfoFactoryMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/DirectoryInfoFactoryMock.cs index 821be5b7b..a8346458f 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/DirectoryInfoFactoryMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/DirectoryInfoFactoryMock.cs @@ -21,17 +21,6 @@ internal DirectoryInfoFactoryMock(MockFileSystem fileSystem) public IFileSystem FileSystem => _fileSystem; - /// - [Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IDirectoryInfo FromDirectoryName(string directoryName) - { - using IDisposable registration = RegisterMethod(nameof(FromDirectoryName), - directoryName); - - return New(directoryName); - } - /// public IDirectoryInfo New(string path) { diff --git a/Source/Testably.Abstractions.Testing/FileSystem/DriveInfoFactoryMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/DriveInfoFactoryMock.cs index f4709200a..0c3574272 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/DriveInfoFactoryMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/DriveInfoFactoryMock.cs @@ -22,17 +22,6 @@ internal DriveInfoFactoryMock(MockFileSystem fileSystem) public IFileSystem FileSystem => _fileSystem; - /// - [Obsolete("Use `IDriveInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IDriveInfo FromDriveName(string driveName) - { - using IDisposable registration = RegisterMethod(nameof(FromDriveName), - driveName); - - return New(driveName); - } - /// public IDriveInfo[] GetDrives() { diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileInfoFactoryMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileInfoFactoryMock.cs index 3c65a6df4..52e4a3912 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/FileInfoFactoryMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/FileInfoFactoryMock.cs @@ -21,17 +21,6 @@ internal FileInfoFactoryMock(MockFileSystem fileSystem) public IFileSystem FileSystem => _fileSystem; - /// - [Obsolete("Use `IFileInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IFileInfo FromFileName(string fileName) - { - using IDisposable registration = RegisterMethod(nameof(FromFileName), - fileName); - - return New(fileName); - } - /// public IFileInfo New(string fileName) { diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileStreamFactoryMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileStreamFactoryMock.cs index 1a481aa42..34b32efb0 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/FileStreamFactoryMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/FileStreamFactoryMock.cs @@ -25,96 +25,6 @@ internal FileStreamFactoryMock(MockFileSystem fileSystem) public IFileSystem FileSystem => _fileSystem; - /// - [Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(string path, FileMode mode) - => New(path, mode); - - /// - [Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(string path, FileMode mode, FileAccess access) - => New(path, mode, access); - - /// - [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); - - /// - [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); - - /// - [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); - - /// - [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); - - /// - [Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(SafeFileHandle handle, FileAccess access) - => New(handle, access); - - /// - [Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize) - => New(handle, access, bufferSize); - - /// - [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); - - /// - [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(); - - /// - [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(); - - /// - [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(); - - /// - [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(); - /// public FileSystemStream New(string path, FileMode mode) { diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherFactoryMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherFactoryMock.cs index 56680cba9..8e8be7350 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherFactoryMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherFactoryMock.cs @@ -22,24 +22,6 @@ internal FileSystemWatcherFactoryMock(MockFileSystem fileSystem) public IFileSystem FileSystem => _fileSystem; - /// - [Obsolete("Use `IFileSystemWatcherFactory.New()` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew() - => New(); - - /// - [Obsolete("Use `IFileSystemWatcherFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew(string path) - => New(path); - - /// - [Obsolete("Use `IFileSystemWatcherFactory.New(string, string)` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew(string path, string filter) - => New(path, filter); - /// public IFileSystemWatcher New() { diff --git a/Source/Testably.Abstractions/FileSystem/DirectoryInfoFactory.cs b/Source/Testably.Abstractions/FileSystem/DirectoryInfoFactory.cs index 77afad9e6..f4cfc5518 100644 --- a/Source/Testably.Abstractions/FileSystem/DirectoryInfoFactory.cs +++ b/Source/Testably.Abstractions/FileSystem/DirectoryInfoFactory.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System.IO; namespace Testably.Abstractions.FileSystem; @@ -16,12 +15,6 @@ internal DirectoryInfoFactory(RealFileSystem fileSystem) /// public IFileSystem FileSystem { get; } - /// - [Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IDirectoryInfo FromDirectoryName(string directoryName) - => New(directoryName); - /// public IDirectoryInfo New(string path) => DirectoryInfoWrapper.FromDirectoryInfo( diff --git a/Source/Testably.Abstractions/FileSystem/DriveInfoFactory.cs b/Source/Testably.Abstractions/FileSystem/DriveInfoFactory.cs index 3f5e3de27..83bdee3fa 100644 --- a/Source/Testably.Abstractions/FileSystem/DriveInfoFactory.cs +++ b/Source/Testably.Abstractions/FileSystem/DriveInfoFactory.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; @@ -17,12 +16,6 @@ internal DriveInfoFactory(RealFileSystem fileSystem) /// public IFileSystem FileSystem { get; } - /// - [Obsolete("Use `IDriveInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IDriveInfo FromDriveName(string driveName) - => New(driveName); - /// public IDriveInfo[] GetDrives() => DriveInfo.GetDrives() diff --git a/Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs b/Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs index d6fa20932..14ac45803 100644 --- a/Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs +++ b/Source/Testably.Abstractions/FileSystem/FileInfoFactory.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System.IO; namespace Testably.Abstractions.FileSystem; @@ -16,12 +15,6 @@ internal FileInfoFactory(RealFileSystem fileSystem) /// public IFileSystem FileSystem { get; } - /// - [Obsolete("Use `IFileInfoFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IFileInfo FromFileName(string fileName) - => New(fileName); - /// public IFileInfo New(string fileName) => FileInfoWrapper.FromFileInfo( diff --git a/Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs b/Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs index c40fa05ce..55ff1b24d 100644 --- a/Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs +++ b/Source/Testably.Abstractions/FileSystem/FileStreamFactory.cs @@ -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; @@ -17,112 +18,6 @@ internal FileStreamFactory(RealFileSystem fileSystem) /// public IFileSystem FileSystem { get; } - /// - [Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(string path, FileMode mode) - => New(path, mode); - - /// - [Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(string path, FileMode mode, FileAccess access) - => New(path, mode, access); - - /// - [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); - - /// - [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); - - /// - [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); - - /// - [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); - - /// - [Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(SafeFileHandle handle, FileAccess access) - => New(handle, access); - - /// - [Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead")] - [ExcludeFromCodeCoverage] - public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize) - => New(handle, access, bufferSize); - - /// - [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); - - /// - [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(); - - /// - [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(); - - /// - [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(); - - /// - [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(); - /// public FileSystemStream New(string path, FileMode mode) => Wrap(new FileStream(path, mode)); diff --git a/Source/Testably.Abstractions/FileSystem/FileSystemWatcherFactory.cs b/Source/Testably.Abstractions/FileSystem/FileSystemWatcherFactory.cs index 42e5615f8..dcbf06a2c 100644 --- a/Source/Testably.Abstractions/FileSystem/FileSystemWatcherFactory.cs +++ b/Source/Testably.Abstractions/FileSystem/FileSystemWatcherFactory.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System.IO; namespace Testably.Abstractions.FileSystem; @@ -16,24 +15,6 @@ internal FileSystemWatcherFactory(RealFileSystem fileSystem) /// public IFileSystem FileSystem { get; } - /// - [Obsolete("Use `IFileSystemWatcherFactory.New()` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew() - => New(); - - /// - [Obsolete("Use `IFileSystemWatcherFactory.New(string)` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew(string path) - => New(path); - - /// - [Obsolete("Use `IFileSystemWatcherFactory.New(string, string)` instead")] - [ExcludeFromCodeCoverage] - public IFileSystemWatcher CreateNew(string path, string filter) - => New(path, filter); - /// public IFileSystemWatcher New() => FileSystemWatcherWrapper.FromFileSystemWatcher(