public void CanReadTest() { ConcatenatedStream cStream = new ConcatenatedStream(streamSampleOne, streamSampleTwo, streamSampleThree); int totalLength = sampleStreamSize * 2; List<byte> output = new List<byte>(); while (cStream.CanRead) { output.Add((byte)cStream.ReadByte()); } Assert.IsTrue( output.Take(sampleStreamSize).SequenceEqual(streamSampleOne.ToArray()), "First array does not match"); Assert.IsTrue( output.Skip(sampleStreamSize).Take(sampleStreamSize).SequenceEqual(streamSampleTwo.ToArray()), "Second array does not match"); Assert.IsTrue( output.Skip(sampleStreamSize * 2).Take(sampleStreamSize).SequenceEqual(streamSampleThree.ToArray()), "Third array does not match"); }
public void ReadAllTest() { ConcatenatedStream cStream = new ConcatenatedStream(streamSampleOne, streamSampleTwo, streamSampleThree); int totalLength = sampleStreamSize * 3; byte[] output = new byte[totalLength]; cStream.Read(output, 0, totalLength); Assert.IsTrue( output.Take(sampleStreamSize).SequenceEqual(streamSampleOne.ToArray()), "First array does not match"); Assert.IsTrue( output.Skip(sampleStreamSize).Take(sampleStreamSize).SequenceEqual(streamSampleTwo.ToArray()), "Second array does not match"); Assert.IsTrue( output.Skip(sampleStreamSize * 2).Take(sampleStreamSize).SequenceEqual(streamSampleThree.ToArray()), "Third array does not match"); }