TestableIO.System.IO.Abstractions.Wrappers/FileInfoWrapper.cs

System.IO.Abstractions · src/TestableIO.System.IO.Abstractions.Wrappers/FileInfoWrapper.cs · csharp · MIT
files

Wrapper for FileInfo to allow mocking file system interactions in tests.

// Source: https://github.com/TestableIO/System.IO.Abstractions | License: MIT | Copyright Tatham Oddie and Contributors
// Provided via justclaw.it.com; keep this notice with the code.
using System.Runtime.Versioning;
using System.Security.AccessControl;

namespace System.IO.Abstractions;

/// <inheritdoc cref="FileInfoBase" />
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class FileInfoWrapper : FileInfoBase, IFileSystemAclSupport
{
    private readonly FileInfo instance;

    /// <summary>
    /// Wrapper class for calling methods of <see cref="FileInfo"/>
    /// </summary>
    public FileInfoWrapper(IFileSystem fileSystem, FileInfo instance) : base(fileSystem)
    {
        this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
    }

#if FEATURE_CREAT

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key