本文整理汇总了C#中File.GetWritingStream方法的典型用法代码示例。如果您正苦于以下问题:C# File.GetWritingStream方法的具体用法?C# File.GetWritingStream怎么用?C# File.GetWritingStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File.GetWritingStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SmartphoneOutputStream
public SmartphoneOutputStream(FileFactory fileFactory, string fileName)
{
var guid = Guid.NewGuid().ToString();
file = fileFactory.Create(fileName);
fileTemp1 = fileFactory.Create(string.Format(TEMP_NAME, fileName, 1, guid));
fileTemp2 = fileFactory.Create(string.Format(TEMP_NAME, fileName, 2, guid));
fileTemp3 = fileFactory.Create(string.Format(TEMP_NAME, fileName, 3, guid));
Stream = fileTemp1.GetWritingStream();
}
示例2: TestInitialize
public void TestInitialize()
{
fileFactory = Substitute.For<FileFactory>();
foo = Substitute.For<File>();
fileFactory.Create("foo").Returns(foo);
fooTemp1 = Substitute.For<File>();
fileFactory.Create(Arg.Is<string>(arg => arg.StartsWith("foo_temp1_"))).Returns(fooTemp1);
fooTemp2 = Substitute.For<File>();
fileFactory.Create(Arg.Is<string>(arg => arg.StartsWith("foo_temp2_"))).Returns(fooTemp2);
fooTemp3 = Substitute.For<File>();
fileFactory.Create(Arg.Is<string>(arg => arg.StartsWith("foo_temp3_"))).Returns(fooTemp3);
fooTemp1WritingStream = Substitute.For<System.IO.Stream>();
fooTemp1.GetWritingStream().Returns(fooTemp1WritingStream);
fooTemp1ReadingStream = Substitute.For<System.IO.Stream>();
fooTemp1.GetReadingStream().Returns(fooTemp1ReadingStream);
foo.Exists.Returns(true);
fooTemp1ReadingStream.Length.Returns(1000);
sut = new SmartphoneOutputStream(fileFactory, "foo");
}