public Write ( long offset, byte buffer, int offsetInBuffer, int count ) : void | ||
offset | long | |
buffer | byte | |
offsetInBuffer | int | |
count | int | |
return | void |
public override void Write(byte[] buffer, int offset, int count) { CheckIfStreamClosed("Write"); if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset < 0 || offset > buffer.Length) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0 || count > buffer.Length - offset) { throw new ArgumentOutOfRangeException("count"); } _sb.Write(_lPosition, buffer, offset, count); _lPosition += count; }
public void Write_NullBufferTest () { ExceptionAssert.Throws<ArgumentNullException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = null; SqlBytes bytes = new SqlBytes (b1); bytes.Write (0, b2, 0, 10); Assert.Fail ("#8 Should throw ArgumentNullException"); }); }
public void Write_InvalidCountTest2 () { ExceptionAssert.Throws<SqlTypeException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (8, b1, 0, (int) b1.Length); Assert.Fail ("#7 Should throw SqlTypeException"); }); }
public void Write_InvalidCountTest1 () { ExceptionAssert.Throws<ArgumentOutOfRangeException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (0, b1, 0, (int) b1.Length+5); Assert.Fail ("#6 Should throw ArgumentOutOfRangeException"); }); }
public void Write_NegativeOffsetInBufferTest () { ExceptionAssert.Throws<ArgumentOutOfRangeException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (0, b1, -1, (int) b1.Length); Assert.Fail ("#4 Should throw ArgumentOutOfRangeException"); }); }
public void Write_SuccessTest1 () { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte[10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (0, b1, 0, (int) b1.Length); Assert.AreEqual (bytes.Value [0], b1 [0], "#1 Should be same"); }
public void Write_InvalidCountTest2() { byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte[] b2 = new byte[10]; SqlBytes bytes = new SqlBytes(b2); Assert.Throws<SqlTypeException>(() => bytes.Write(8, b1, 0, b1.Length)); }
public void Write_SuccessTest2 () { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [20]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (8, b1, 0, 10); Assert.AreEqual (bytes.Value [8], b1 [0], "#10 Should be same"); Assert.AreEqual (bytes.Value [17], b1 [9], "#10 Should be same"); }
public void Write_NegativeOffsetTest () { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (-1, b1, 0, (int) b1.Length); Assert.Fail ("#2 Should throw ArgumentOutOfRangeException"); }
public void Write_NegativeCountTest() { byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte[] b2 = new byte[10]; SqlBytes bytes = new SqlBytes(b2); Assert.Throws<ArgumentOutOfRangeException>(() => bytes.Write(0, b1, 0, -1)); }
public void Write_NullBufferAndInstanceValueTest() { byte[] b1 = null; SqlBytes bytes = new SqlBytes(); Assert.Throws<ArgumentNullException>(() => bytes.Write(0, b1, 0, 10)); }
public void Write_NullInstanceValueTest() { byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; SqlBytes bytes = new SqlBytes(); Assert.Throws<SqlTypeException>(() => bytes.Write(0, b1, 0, 10)); }
public void Write_NullBufferTest() { byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte[] b2 = null; SqlBytes bytes = new SqlBytes(b1); Assert.Throws<ArgumentNullException>(() => bytes.Write(0, b2, 0, 10)); }
public void Write_NullInstanceValueTest () { ExceptionAssert.Throws<SqlTypeException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; SqlBytes bytes = new SqlBytes(); bytes.Write (0, b1, 0, 10); Assert.Fail ("#9 Should throw SqlTypeException"); }); }
public void Write_InvalidOffsetTest () { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (bytes.Length+5, b1, 0, (int) b1.Length); Assert.Fail ("#3 Should throw SqlTypeException"); }
public void Write_NullBufferAndInstanceValueTest () { ExceptionAssert.Throws<ArgumentNullException>( delegate { byte [] b1 = null; SqlBytes bytes = new SqlBytes(); bytes.Write (0, b1, 0, 10); Assert.Fail ("#9 Should throw ArgumentNullException"); }); }
public void Write_InvalidOffsetInBufferTest () { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (0, b1, b1.Length+5, (int) b1.Length); Assert.Fail ("#5 Should throw ArgumentOutOfRangeException"); }
public void Write_NegativeCountTest () { ExceptionAssert.Throws<ArgumentOutOfRangeException>( delegate { byte [] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte [] b2 = new byte [10]; SqlBytes bytes = new SqlBytes (b2); bytes.Write (0, b1, 0, -1); Assert.Fail ("#11 Should throw ArgumentOutOfRangeException"); }); }
public void Write_InvalidOffsetInBufferTest() { byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; byte[] b2 = new byte[10]; SqlBytes bytes = new SqlBytes(b2); Assert.Throws<ArgumentOutOfRangeException>(() => bytes.Write(0, b1, b1.Length + 5, b1.Length)); }