-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set Creation, LastAccess and LastWrite time for files #875
feat: set Creation, LastAccess and LastWrite time for files #875
Conversation
7ecbd63
to
30df259
Compare
Please note, that I changed the Interface I am not sure what I should do: |
If this is an accepted approach, I could also try to have a look at #839, which deals with the times of directories. This would probably be quite similar... |
Sorry @vbreuss, I'm a bit busy with other things, will try to have a look by the end of this week! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also apply time in MockFileStream Mark MockFile_AfterSetAccessControl_ShouldUpdateLastAccessTime as Windows-Only Fix name of unit tests to match the actual expected behavior
510c290
to
99ebdab
Compare
…ind` in the various methods/properties.
…ess-and-last-write-times
@siprbaum : I merged the latest changes, so that this branch is up to date. |
@siprbaum : Thanks for the review! Regarding the user detectable behaviour change: |
…ess-and-last-write-times
…ess-and-last-write-times
@fgreinacher : I merged the latest |
Co-authored-by: Florian Greinacher <florian@greinacher.de>
Co-authored-by: Florian Greinacher <florian@greinacher.de>
This is addressed in release v17.2.3. |
This is addressed in release v17.2.3. |
Implements #872
Adjust
CreationTime
,LastAccessTime
andLastWriteTime
when interacting with files in theMockFileSystem
.Provides a means to mock the used DateTime by calling e.g.
Implementes the following logic in MockFile:
All these cases are covered by unit tests in MockFileAdjustTimesTest
CreationTime, LastAccessTime and LastWriteTime are set to the current time
WriteAllText
,WriteAllBytes
,AppendAllText
,OpenWrite
,Open
)LastAccessTime and LastWriteTime are set to the current time
CreationTime is left unchanged
ReadAllText
,ReadAllLines
,ReadAllBytes
,OpenRead
)LastAccessTime is set to the current time
CreationTime and LastWriteTime are left unchanged
SetAttributes
,SetAccessControl
)LastAccessTime is set to the current time
CreationTime and LastWriteTime are left unchanged
Move
)LastAccessTime is set to the current time
CreationTime and LastWriteTime are left unchanged
Copy
)CreationTime and LastAccessTime of the copied file in the destination directory is set to the current time
LastWriteTime and all times of the source file are left unchanged