简体   繁体   English

System.IO.Abstractions的用法

[英]System.IO.Abstractions usage

I'm writing some unit tests using System.IO.Abstractions following the sample code in GitHub and got stuck here: 我正在按照GitHub中的示例代码使用System.IO.Abstractions编写一些单元测试,并被卡在此处:

fileSystem: new FileSystem() //use default implementation which calls System.IO

This line is meant to initialise System.IO.FileSystem but that class does not exist... do you know if it has been deprecated or am I getting this wrong? 该行用于初始化System.IO.FileSystem,但该类不存在...您知道它是否已被弃用,还是我弄错了?

Thanks! 谢谢!

yes, in the production code, you should inject an instance of System.IO.Abstractions.FileSystem . 是的,在生产代码中,应该注入System.IO.Abstractions.FileSystem的实例。 In your test code an instance of System.IO.Abstractions.TestingHelpers.MockFileSystem . 在您的测试代码中,有一个System.IO.Abstractions.TestingHelpers.MockFileSystem的实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.IO.Abstractions的局限性 - System.IO.Abstractions Limitations 从 System.IO.Abstractions 抛出 UnauthorizedAccessException - Throw UnauthorizedAccessException from System.IO.Abstractions System.IO.Abstractions 模拟文件删除 - System.IO.Abstractions Mock File Delete 为什么我不能将System.IO.Abstractions与Ninject绑定? - Why can't I bind System.IO.Abstractions with Ninject? 如何使用 System.IO.Abstractions 模拟 FileInfo class? - How can the FileInfo class be mocked using System.IO.Abstractions? 如何使用System.IO.Abstractions中的FileSystemWatcher监视模拟文件系统? - How can I use FileSystemWatcher from System.IO.Abstractions to monitor a mock filesystem? System.Web.Abstractions dll缺少HttpPostedFileBase类 - System.Web.Abstractions dll is Missing HttpPostedFileBase Class 一个大的System.IO.MemoryStream会导致我的应用程序的内存使用量急剧增加吗? - Will a large System.IO.MemoryStream result in my application's memory usage increasing dramatically? IO Async方法中的TaskCompletionSource用法 - TaskCompletionSource usage in IO Async methods 查询上的RavenDB异常 - 未找到方法:'Void Raven.Abstractions.Data.IndexQuery.set_DefaultField(System.String)' - RavenDB exception on query - Method not found: 'Void Raven.Abstractions.Data.IndexQuery.set_DefaultField(System.String)'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM