当前位置: 首页 > news >正文

天河区门户网站教育局东莞seoseo关键词排名优化

天河区门户网站教育局,东莞seoseo关键词排名优化,深圳建设工程交易宝安,开展我国电子网站建设刚看到这个Namespace的时候还以为是.Net Framework里自带的包#xff0c;结果查了一圈无任何结果。果断上Github搜索#xff0c;一击即中 https://github.com/tathamoddie/System.IO.Abstractions先翻译下开发者给出的简单说明#xff0c;今后再慢慢使用类似于System.Web.Ab… 刚看到这个Namespace的时候还以为是.Net Framework里自带的包结果查了一圈无任何结果。果断上Github搜索一击即中 https://github.com/tathamoddie/System.IO.Abstractions先翻译下开发者给出的简单说明今后再慢慢使用类似于System.Web.Abstractions的用法System.IO也被扩展了它能针对可测的IO进行访问Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access!只能用NuGet方式下载NuGet only:1 Install-Package System.IO.Abstractions如果有需要可以下载测试帮助包and/or:1 Install-Package System.IO.Abstractions.TestingHelpers本库最核心的2个文件是IFileSystem和FileSystem。使用IFileSystem.File.ReadAllText等方法替换掉之前的File.ReadAllText等方法。除了一些我们扩展和进行测试的方法外其他API也基本完全相同。At the core of the library is IFileSystem and FileSystem. Instead of calling methods like File.ReadAllText directly, use IFileSystem.File.ReadAllText. We have exactly the same API, except that ours is injectable and testable.1 public class MyComponent 2 { 3 readonly IFileSystem fileSystem; 4 5 // summaryCreate MyComponent with the given fileSystem implementation/summary 6 public MyComponent(IFileSystem fileSystem) 7 { 8 this.fileSystem fileSystem; 9 } 10 /// summaryCreate MyComponent/summary 11 public MyComponent() : this( 12 fileSystem: new FileSystem() //use default implementation which calls System.IO 13 ) 14 { 15 } 16 17 public void Validate() 18 { 19 foreach (var textFile in fileSystem.Directory.GetFiles(c:\, *.txt, SearchOption.TopDirectoryOnly)) 20 { 21 var text fileSystem.File.ReadAllText(textFile); 22 if (text ! Testing is awesome.) 23 throw new NotSupportedException(We cant go on together. Its not me, its you.); 24 } 25 } 26 }这个库中还包含了一系列测试程序来帮助你熟悉它。虽然它不是一个成熟的文件系统但是它一定会给你带来帮助的。The library also ships with a series of test helpers to save you from having to mock out every call, for basic scenarios. They are not a complete copy of a real-life file system, but theyll get you most of the way there. 1 [Test]  2 public void MyComponent_Validate_ShouldThrowNotSupportedExceptionIfTestingIsNotAwesome() 3 { 4 // Arrange 5 var fileSystem new MockFileSystem(new Dictionarystring, MockFileData 6 { 7 { c:\myfile.txt, new MockFileData(Testing is meh.) }, 8 { c:\demo\jQuery.js, new MockFileData(some js) }, 9 { c:\demo\image.gif, new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) } 10 }); 11 var component new MyComponent(fileSystem); 12 13 try 14 { 15 // Act 16 component.Validate(); 17 } 18 catch (NotSupportedException ex) 19 { 20 // Assert 21 Assert.AreEqual(We cant go on together. Its not me, its you., ex.Message); 22 return; 23 } 24 25 Assert.Fail(The expected exception was not thrown.); 26 }我们甚至支持把.NET框架里不可测试的类型加入到测试程序里We even support casting from the .NET Frameworks untestable types to our testable wrappers: 1 FileInfo SomeBadApiMethodThatReturnsFileInfo()  2 { 3 return new FileInfo(a); 4 } 5 6 void MyFancyMethod() 7 { 8 var testableFileInfo (FileInfoBase)SomeBadApiMethodThatReturnsFileInfo(); 9 //... 10 }
http://wiki.neutronadmin.com/news/200864/

相关文章:

  • 网站成品下载wordpress打分
  • 恢复被百度k网站 关键词收录广州移动 网站建设
  • 西宁网站系统建设东莞软件设计
  • 江苏网站建设费用赣州网站开发公司
  • 企业网站系统功能设计说明wordpress第三方支付插件
  • 天津企业网站制作中小型网站建设策划
  • wordpress透明沈阳seo公司
  • 网站建设格式百度地图放到网站上
  • 网站框架是谁做知识产权教育网站建设方案
  • 制作网站公司哪里好东莞通充值
  • 东莞建站模板公司做网站合同范本
  • 网站设计分析案例网站备案要拍照大家怎么做的啊
  • 网站遭受攻击professional wordpress
  • 网站icp备案查询截图机加工如何用网站开发客户
  • 贵阳网站设计方案wordpress怎么关注站点
  • 烟台做网站打电话话术做自媒体哪个平台最好
  • 建设银行培训网站公司主页填什么
  • 河南网站建设价格与方案工商营业执照查询官网
  • 山东省水利建设市场信用信息平台网站wordpress手机适配模板中文
  • com域名注册1元关键词优化精灵
  • 网站用户需求报告外包公司是做什么的
  • wordpress 工具栏图标做搜狗手机网站优化软
  • 东莞网站网站建设养老院网站建设方案
  • 呼和浩特网站seo优化方案重庆建设工程造价信息网官网查询
  • 专业长春网站建设工作室如何使用dw制作网页
  • 地方门户网站用户宣传展示型网站设计
  • 免费生成网站的app校园推广公司
  • 做网站需要空间网站开发毕设开题报告怎么写
  • wordpress粘贴媒体库优化网站技术
  • 酒店 手机网站模板绍兴网站推广优化