Skip to content

FileStream.Create with FileMode.CreateNew doesn't throw exception when file already exists #532

@PaulVrugt

Description

@PaulVrugt

When not using mocking, creating a filestream using FileMode.CreateNew throws an IOException when the target file already exists. However, the MockFileStream constructor behaves differently. When passing CreateNew as FileMode, it truncates the file. This causes issues for us in our unit tests, since the test scenario behaves differently than then real code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testinghelpersIssues that address the testing helpersstate: ready to pickIssues that are ready for being worked ontype: bugIssues that describe misbehaving functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions