feat: Add `Name` to `IFile.Create` (and others)
Added draft implementation of a FileStream-like class It is not plumbed in at all because I want to discuss the approach first.
@fgreinacher is this kind of what you were thinking in #779 ? I figured if this is correct, I can go through and update all the related Stream references to return FileStream with the Name property properly set.
Just for reference, there are a few other fields that I am not sure I want to tackle now that we could eventually add here:
Handle(obsolete)IsAsync- Gets a value that indicates whether the FileStream was opened asynchronously or synchronouslySafeFileHandle- Gets a SafeFileHandle object that represents the operating system file handle for the file that the current FileStream object encapsulates
(see https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream?view=net-6.0#properties)
@fgreinacher is this kind of what you were thinking in #779 ? I figured if this is correct, I can go through and update all the related
Streamreferences to returnFileStreamwith theNameproperty properly set.
Yes, that's what I had In mind, thanks for taking care!
Just for reference, there are a few other fields that I am not sure I want to tackle now that we could eventually add here:
Handle(obsolete)IsAsync- Gets a value that indicates whether the FileStream was opened asynchronously or synchronouslySafeFileHandle- Gets a SafeFileHandle object that represents the operating system file handle for the file that the current FileStream object encapsulates(see https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream?view=net-6.0#properties)
I think we can ignore Handle and SafeFileHandle as these would be impossible to mock in a useful way. I'm unsure about IsAsync - do you have an idea what this is commonly used for?
Just for reference, there are a few other fields that I am not sure I want to tackle now that we could eventually add here:
Handle(obsolete)IsAsync- Gets a value that indicates whether the FileStream was opened asynchronously or synchronouslySafeFileHandle- Gets a SafeFileHandle object that represents the operating system file handle for the file that the current FileStream object encapsulates(see https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream?view=net-6.0#properties)
I think we can ignore
HandleandSafeFileHandleas these would be impossible to mock in a useful way. I'm unsure aboutIsAsync- do you have an idea what this is commonly used for?
IsAsync is something that can be specified when opening a file that will hint to the system whether IO should be on a ThreadPool thread or not. I'm not very familiar with it.
I think I should add it anyway, since it's just a pass-through property and it's readonly. I'll do that and the other things in the review today, and then I'll start wiring this in.
I think this pull request could be closed, as it is now implemented as FileSystemStream in #906.
Do you agree, @BrianMcBrayer ?
I agree. I feel bad I did not get around to getting this PR in when it was needed 😬