本文整理汇总了C#中TestFilter.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# TestFilter.CopyTo方法的具体用法?C# TestFilter.CopyTo怎么用?C# TestFilter.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestFilter
的用法示例。
在下文中一共展示了TestFilter.CopyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestOperations
public void TestOperations()
{
// invalid operations
using (var filter = new FilterStream(CreateStream("test", true)))
{
AssertException(() => filter.Seek(0, SeekOrigin.Current));
AssertException(() => filter.Write(new Byte[10], 0, 10));
}
// filter read/write
using (var reader = new TestFilter(CreateStream("test")))
using (var writer = new TestFilter(new MemoryStream()))
{
reader.CopyTo(writer);
Assert.IsTrue(AreEqual(reader.Log, writer.Log));
}
using (var reader = new TestFilter(CreateStream(String.Join("", Enumerable.Repeat("123", 1000)))))
using (var writer = new TestFilter(new MemoryStream()))
{
reader.CopyTo(writer);
Assert.IsTrue(AreEqual(reader.Log, writer.Log));
}
// filter flush/dispose
using (var reader1 = new TestFilter(CreateStream("test")))
using (var reader2 = new FilterStream(reader1))
using (var writer1 = new TestFilter(new MemoryStream()))
using (var writer2 = new FilterStream(writer1))
{
reader2.CopyTo(writer2);
Assert.IsTrue(AreEqual(reader1.Log, writer1.Log));
Assert.IsFalse(writer1.Flushed);
writer2.Flush();
Assert.IsTrue(writer1.Flushed);
Assert.IsFalse(reader1.Disposed);
Assert.IsFalse(writer1.Disposed);
reader2.Dispose();
writer2.Dispose();
Assert.IsTrue(reader1.Disposed);
Assert.IsTrue(writer1.Disposed);
}
}