public void writeFromBufferWithOffsetPlusLengthGreaterThanBufferLength() { byte[] buffer = new byte[1]; // Create Constructor Parameters using (MemoryStream stream = new MemoryStream()) using (JavaOutputStreamAdapter testSubject = NewTestSubject(stream)) { testSubject.write(buffer, 0, -1); } }
public void writeFromBufferWithNegativeOffset() { byte[] buffer = new byte[1]; // Create Constructor Parameters using (MemoryStream stream = new MemoryStream()) using (JavaOutputStreamAdapter testSubject = NewTestSubject(stream)) { testSubject.write(buffer, -1, 1); } }
public void writeFromNullBuffer() { byte[] buffer = null; // Create Constructor Parameters using (MemoryStream stream = new MemoryStream()) { JavaOutputStreamAdapter testSubject = NewTestSubject(stream); testSubject.write(buffer); } }
public void writeByte() { // Create Constructor Parameters using (MemoryStream stream = new MemoryStream()) using (JavaOutputStreamAdapter testSubject = NewTestSubject(stream)) { int b = 1; testSubject.write(b); testSubject.flush(); Assert.AreEqual(1, stream.Length); } }
public void writeFromBufferWithValidOffsetAndLength() { byte[] buffer = new byte[] { (byte)'a', (byte)'s', (byte)'d', (byte)'f' }; // Create Constructor Parameters using (MemoryStream stream = new MemoryStream()) using (JavaOutputStreamAdapter testSubject = NewTestSubject(stream)) { testSubject.write(buffer, 0, 4); Assert.AreEqual(4, stream.Length); stream.Position = 0; Assert.AreEqual((int)'a', stream.ReadByte()); Assert.AreEqual((int)'s', stream.ReadByte()); Assert.AreEqual((int)'d', stream.ReadByte()); Assert.AreEqual((int)'f', stream.ReadByte()); Assert.AreEqual(-1, stream.ReadByte()); } }