当前位置: 首页>>代码示例>>C#>>正文


C# IFileSystem.ReadStringFromFile方法代码示例

本文整理汇总了C#中IFileSystem.ReadStringFromFile方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystem.ReadStringFromFile方法的具体用法?C# IFileSystem.ReadStringFromFile怎么用?C# IFileSystem.ReadStringFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFileSystem的用法示例。


在下文中一共展示了IFileSystem.ReadStringFromFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

			public void SetUp()
			{
				string nestedDependencyFilename = Path.Combine("a", "b", "variables.less");
				string nestedDependencyText = "@import \"dependency.less\";";
				
				dependencyFilename = Path.Combine("a", "b", "dependency.less");
				var dependencyText = "@color: #4D926F;";
				
				source = "@import \"variables.less\";#header {color: @color;}h2 {color: @color;}";
				expected = "#header{color:#4d926f}h2{color:#4d926f}";
				
				arguments = new Dictionary<string, object> {
					{
						"item",
						new Dictionary<string, object> {
							{ "filename", Path.Combine("a", "b", "c.less") }
						}
					}
				};
				
				fileSystem = Substitute.For<IFileSystem>();
				fileSystem.FileExists(nestedDependencyFilename).Returns(true);
				fileSystem.ReadStringFromFile(nestedDependencyFilename).Returns(nestedDependencyText);
				fileSystem.FileExists(dependencyFilename).Returns(true);
				fileSystem.ReadStringFromFile(dependencyFilename).Returns(dependencyText);
				
				lessFilter = new LessFilter(fileSystem);
			}
开发者ID:wilsonmar,项目名称:mulder,代码行数:28,代码来源:LessFilterTests.cs

示例2: SetUp

			public void SetUp()
			{
				string fakeConfigFile = @"property_one: one";

				string fakeRulesFile = @"Compile(""*"", (context) => {
	// Do Nothing
});
Route(""*"", (context) => {
	return string.Empty;
});
Layout(""*"", ""layout-filter"");";
				
				log = Substitute.For<ILog>();
				fileSystem = Substitute.For<IFileSystem>();
				fileSystem.FileExists("config.yaml").Returns(true);
				fileSystem.ReadStringFromFile("config.yaml").Returns(fakeConfigFile);
				fileSystem.FileExists("Rules").Returns(true);
				fileSystem.ReadStringFromFile("Rules").Returns(fakeRulesFile);
				
				loader = new Loader(log, fileSystem);
			}
开发者ID:wilsonmar,项目名称:mulder,代码行数:21,代码来源:LoaderTests.cs

示例3: SetUp

			public void SetUp()
			{
				var fakeFiles = CreateFakeFileList();
				expectedModificationTime = DateTime.UtcNow;
				
				log = Substitute.For<ILog>();
				
				fileSystem = Substitute.For<IFileSystem>();
				fileSystem.GetAllFiles("layouts").Returns(fakeFiles);
				fileSystem.ReadStringFromFile(Path.Combine("layouts", "a.html")).Returns("---\nnum: 1\n---\ntest 1");
				fileSystem.ReadStringFromFile(Path.Combine("layouts", "b.html")).Returns("test 2");
				fileSystem.ReadStringFromFile(Path.Combine("layouts", "b.yaml")).Returns("num: 2");
				fileSystem.GetLastWriteTimeUtc(Arg.Any<string>()).Returns(expectedModificationTime);
				
				configuration = Substitute.For<IConfiguration>();
				configuration.TextExtensions.Returns(new string[] { "html", "yaml" });
				
				fileSystemUnified = new FileSystemUnified(log, fileSystem, configuration);
			}
开发者ID:wilsonmar,项目名称:mulder,代码行数:19,代码来源:FileSystemUnifiedTests.cs


注:本文中的IFileSystem.ReadStringFromFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。