I have a script in which I need most of the information from the FileInfo structure - creation time, last recording time, file size, etc. I need to be able to get this information cleanly, but also to be able to truly unit test without getting into the file system.
I use System.IO.Abstractions, so I get 99% of this path for most of my class except this one. I do not know how to use it to get the necessary information from my object MockFileSystem.
public void Initialize(IFileSystem fs, string fullyQualifiedFileName)
{
string pathOnly = fs.Path.GetDirectoryName(fullyQualifiedFileName);
string fileName = fs.Path.GetFileName(fullyQualifiedFileName);
FileInfo fi = new FileInfo(fullyQualifiedFileName);
long size = fi.LongLength;
DateTime lastWrite = fi.LastWriteTime;
...
...
}
Any help on this line would be greatly appreciated.
UPDATE:
This is not an exact duplicate of existing questions, because I am asking how to do this with help System.IO.Abstractions, and not how to do it at all.
, , :
FileInfoBase fi = _fs.FileInfo.FromFileName(fullFilePath);
, , TEST PROD.