public void It_should_be_able_to_seek_from_current_with_offset(int position, int offset) { using (var stream = new StreamingAssetsStream(RyujuEngineIOText)) { stream.Position = position; Assert.That(stream.Seek(offset, SeekOrigin.Current), Is.EqualTo(position + offset), "It must be able to seek to valid position."); Assert.That(stream.Position, Is.EqualTo(position + offset), "It must be able to return valid position."); } }
public void It_should_be_able_to_read_no_bytes_from_tail() { using (var stream = new StreamingAssetsStream(RyujuEngineIOText)) { var buffer = new byte[42]; int count = 0; stream.Seek(0, SeekOrigin.End); Assert.That(() => count = stream.Read(buffer, 0, buffer.Length), Throws.Nothing, "It must be able to read no bytes from tail."); Assert.That(count, Is.EqualTo(0), "It must be able to return zero even if read from tail."); } }