public void write() { byte[] actual = testData.ToArray(); MemoryStream memStream = new MemoryStream(actual, true); memStream.Seek(testDataOffset, SeekOrigin.Current); RangeStream rangeStream = new RangeStream(memStream, 4, true); byte[] expected = testData.ToArray(); expected[testDataOffset + 0] = 0x10; expected[testDataOffset + 1] = 0x20; expected[testDataOffset + 2] = 0x30; expected[testDataOffset + 3] = 0x40; rangeStream.Write(expected, testDataOffset, testDataLength); Assert.AreEqual(expected, actual); }