本文整理汇总了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);
}
示例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);
}
示例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);
}