Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
495 views
in Technique[技术] by (71.8m points)

unit testing - MOQ IFileSystem lots of data sample code needed

I was wondering if there already existed some sample data of a fake/moq filesystem for unit testing? Instead of using DirectoryInfo/FileInfo, I am using System.IO.Abstractions and would like to take some existing code that already built out a large/fake file system with directories/subdirectories, etc. rather than having to write my own or generate lots of fake data.

Verify call to File.Delete with System.IO.Abstractions.TestingHelpers

What I don't want to do is manually create the entire system myself:

var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
    { @"c:Test", new MockDirectoryData() },
    { @"c:Testsubfolder1myNewFile.txt", new MockFileData(string.Empty) }
});

But instead, just load from a file or code that has lots of files with different sizes, dates, names, extensions, etc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...