Skip to content

Is FileStream covered? #224

Closed
Closed

Description

@THammond9

I need to be able to test a FileStream but I don't see anyway to do it with what it currently implemented. I see PR #177 but it hasn't been merged yet and the PR is 6 months old. I assume that FileStream is already covered in some way?

Activity

  1. bmcd77 commented on Jun 29, 2017

    @bmcd77

    I was also looking to mock a FileStream and initially couldn't find how to mock a FileStream. See :
    FileInfo.FromFileName(....). Here's a line from my code:

    private readonly IFileSystem _fileSystem;

    Constructor Inject into _fileSystem as usual.

    FileStream fileStreamBack = null;
    using (fileStreamBack = (FileStream)_fileSystem.FileInfo.FromFileName(fileFrom).Open(FileMode.Open, FileAccess.Read))
    using (var fileStreamf = (FileStream)_fileSystem.FileInfo.FromFileName(fileTo).Open(FileMode.Create, FileAccess.Write))
    {
    fileStreamBack.CopyTo(fileStreamf);
    fileStreamBack.Flush(); // Making sure
    fileStreamBack.Close(); // Making sure
    }

  2. jpreese commented on Jul 11, 2018

    @jpreese
    Member

    To be resolved by #177

  3. added a commit that references this issue on Nov 1, 2024
    3fc0b03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementIssues that propose new functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions