public void TestWriteOffset()
 {
     using (TestStream io = new TestStream())
         using (BackgroundWriter wtr = new BackgroundWriter(io))
         {
             wtr.Write(new byte[100], 0, 100);
             wtr.Write(1, new byte[] { 42 }, 0, 1);
             wtr.Flush();
             Assert.AreEqual(2, io.Position);
             Assert.AreEqual(100, io.Length);
             io.Position = 1;
             Assert.AreEqual(42, io.ReadByte());
         }
 }
 public void TestWriteOffsetAndSignal()
 {
     using (ManualResetEvent mre = new ManualResetEvent(false))
         using (TestStream io = new TestStream())
             using (BackgroundWriter wtr = new BackgroundWriter(io))
             {
                 wtr.Write(new byte[100], 0, 100);
                 wtr.Write(1, new byte[] { 42 }, 0, 1, mre);
                 Assert.IsTrue(mre.WaitOne(60000, false));
                 Assert.AreEqual(2, io.Position);
                 Assert.AreEqual(100, io.Length);
                 io.Position = 1;
                 Assert.AreEqual(42, io.ReadByte());
             }
 }
 public void TestWriteOffset()
 {
     using (TestStream io = new TestStream())
     using (BackgroundWriter wtr = new BackgroundWriter(io))
     {
         wtr.Write(new byte[100], 0, 100);
         wtr.Write(1, new byte[] { 42 }, 0, 1);
         wtr.Flush();
         Assert.AreEqual(2, io.Position);
         Assert.AreEqual(100, io.Length);
         io.Position = 1;
         Assert.AreEqual(42, io.ReadByte());
     }
 }
 public void TestWriteOffsetAndSignal()
 {
     using (ManualResetEvent mre = new ManualResetEvent(false))
     using (TestStream io = new TestStream())
     using (BackgroundWriter wtr = new BackgroundWriter(io))
     {
         wtr.Write(new byte[100], 0, 100);
         wtr.Write(1, new byte[] { 42 }, 0, 1, mre);
         Assert.IsTrue(mre.WaitOne(60000, false));
         Assert.AreEqual(2, io.Position);
         Assert.AreEqual(100, io.Length);
         io.Position = 1;
         Assert.AreEqual(42, io.ReadByte());
     }
 }