public void ReadFromStream() { var buffer = new byte[] { 1, 2, 3, 4, 5, 6 }; const uint frameSize = 3; var ram = new Ram(buffer, frameSize); var s = ram.GetStream(0); Assert.That(s.Length, Is.EqualTo(frameSize)); Assert.That(s.ToArray(), Is.EquivalentTo(new[] { 1, 2, 3 })); var s2 = ram.GetStream(1); Assert.That(s2.Length, Is.EqualTo(frameSize)); Assert.That(s2.ToArray(), Is.EquivalentTo(new[] { 4, 5, 6 })); }
public void WriteToStream() { var buffer = new byte[] { 1, 2, 3, 4, 5, 6 }; const uint frameSize = 3; var ram = new Ram(buffer, frameSize); var s = ram.GetStream(0); s.WriteByte(99); Assert.That(s.ToArray(), Is.EquivalentTo(new[] { 99, 2, 3 })); }