public void ByteArrayRead(int dataIndex, BufferType bufferType, int offset, int length, ReadResult expectedResult) { var cs = new ConcatStream(); cs.Append(ReadingSourceData[dataIndex]); ConcatStreamReadTest(cs, bufferType, offset, length, expectedResult); }
public void SystemIOAppendEquality() { var data = new System.IO.MemoryStream(); var cs = new ConcatStream(); var stream = cs.Append(data); Assert.That(cs, Is.EqualTo(stream)); }
public void ByteArrayAppendEquality() { var data = new byte[0]; var cs = new ConcatStream(); var stream = cs.Append(data); Assert.That(cs, Is.EqualTo(stream)); }
public void ByteArrayGetPosition() { var data = new byte[10]; var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.Position, Is.Zero); }
public void ByteArrayCanSeek() { var data = new byte[0]; var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.CanSeek, Is.True); }
public void ByteArrayLength() { var data = new byte[10]; var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.Length, Is.EqualTo(10)); }
public void ByteArrayEmptyLength() { var data = new byte[0]; var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.Length, Is.Zero); }
public void SystemIOGetPosition() { var data = new System.IO.MemoryStream(new byte[10]); var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.Position, Is.Zero); Assert.That(data.Position, Is.Zero); }
public void SystemIOStreamNull() { System.IO.Stream data = null; var cs = new ConcatStream(); Assert.Throws <System.ArgumentNullException>(() => { cs.Append(data); }); }
public void ByteArrayNull() { byte[] data = null; var cs = new ConcatStream(); Assert.Throws <System.ArgumentNullException>(() => { cs.Append(data); }); }
public void SystemIOStreamReadable() { var data = Substitute.For <System.IO.Stream>(); data.CanSeek.Returns(true); data.CanRead.Returns(true); data.Position.Returns(0); data.Length.Returns(StreamSourceDefaultLength); var cs = new ConcatStream(); cs.Append(data); }
public void SystemIOCanSeekFalse() { var data = Substitute.For <System.IO.Stream>(); data.CanSeek.Returns(false); data.CanRead.Returns(true); data.Position.Returns(0); data.Length.Returns(StreamSourceDefaultLength); var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.CanSeek, Is.False); }
public void SystemIOStreamNotReadable() { var data = Substitute.For <System.IO.Stream>(); data.CanSeek.Returns(true); data.CanRead.Returns(false); data.Position.Returns(0); data.Length.Returns(StreamSourceDefaultLength); var cs = new ConcatStream(); Assert.Throws <System.ArgumentException>(() => { cs.Append(data); }); }
public void SystemIOSetPositionInvalid() { var data = new System.IO.MemoryStream(new byte[10]); var cs = new ConcatStream(); cs.Append(data); Assert.Throws <System.ArgumentOutOfRangeException>(() => { cs.Position = -1; }); Assert.Throws <System.ArgumentOutOfRangeException>(() => { cs.Position = 11; }); }
public void SystemIOReadPassthrough() { // As calls are simply passed through to the stream, it's Stream dependent. So just make sure the stream was effected var data = new System.IO.MemoryStream(new byte[10]); var cs = new ConcatStream(); cs.Append(data); Assert.That(cs.Position, Is.Zero); Assert.That(data.Position, Is.Zero); var buffer = new byte[5]; var read = cs.Read(buffer, 0, 3); Assert.That(read, Is.EqualTo(3)); Assert.That(cs.Position, Is.EqualTo(3)); Assert.That(data.Position, Is.EqualTo(3)); }