public void TestSimpleByte() { byte[] result = null; bool complete = false; using (PipelineStream pipeline = new PipelineStream(new CancellationToken())) { Task producerTask = Task.Run(() => { pipeline.WriteByte(13); pipeline.Complete(); }); Task consumerTask = Task.Run(() => { byte[] r = new byte[1]; r[0] = (byte)pipeline.ReadByte(); result = r; complete = pipeline.ReadByte() == -1; }); Task.WaitAll(producerTask, consumerTask); } Assert.That(result[0], Is.EqualTo(13), "The byte written and read has the value 13."); Assert.That(complete, Is.True, "Since only one byte was written, complete should be set as well."); }