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


C# TestFilter.CopyTo方法代码示例

本文整理汇总了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);
      }
 }
开发者ID:bspell1,项目名称:SkyFloe,代码行数:40,代码来源:TestFilterStream.cs


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