Skip to content

Use Cake's IFileSystem for read/write operations instead of System.IO.File#118

Merged
augustoproiete merged 3 commits intocake-contrib:developfrom
ap0llo:use-ifilesystem
Feb 21, 2023
Merged

Use Cake's IFileSystem for read/write operations instead of System.IO.File#118
augustoproiete merged 3 commits intocake-contrib:developfrom
ap0llo:use-ifilesystem

Conversation

@ap0llo
Copy link
Copy Markdown
Contributor

@ap0llo ap0llo commented Feb 17, 2023

Description

In all file aliases, use Cake's IFileSystem abstraction instead of using System.IO.File.
This enables testing of tasks that use the file aliases by mocking IFileSystem.

The FileTouch() alias continues to use System.IO.File since there is no API in IFileSystem that allows setting the last write time.

Related Issue

This PR fixes #117

Motivation and Context

See #117. This enables mocking of the file system in tests for tasks

How Has This Been Tested?

All tests in the project are still passing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes. (Covered by existing tests)
  • All new and existing tests passed.

@augustoproiete augustoproiete self-requested a review February 18, 2023 07:22
Copy link
Copy Markdown
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @ap0llo! Concept ACK and overall LGTM. Added a couple of minor comments/requests

@ap0llo
Copy link
Copy Markdown
Contributor Author

ap0llo commented Feb 20, 2023

Thanks for your review! I applied your suggestions, please let me know if there is anything else you'd like me to adapt.

ap0llo and others added 3 commits February 20, 2023 23:34
….File

In all file aliases, use Cake's IFileSystem abstraction instead of using System.IO.File.
This enables testing of tasks that use the file aliases by mocking IFileSystem.

The FileTouch() alias continues to use System.IO.File since there is no API in IFileSystem that allows setting the last write time.
Co-authored-by: C. Augusto Proiete <augusto@proiete.com>
Co-authored-by: C. Augusto Proiete <augusto@proiete.com>
Copy link
Copy Markdown
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@augustoproiete augustoproiete merged commit ead9d86 into cake-contrib:develop Feb 21, 2023
@ap0llo ap0llo mentioned this pull request Mar 13, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Cake's IFileSystem for read/write operations instead of System.IO.File

2 participants