Write() public method

public Write ( long offset, char buffer, int offsetInBuffer, int count ) : void
offset long
buffer char
offsetInBuffer int
count int
return void
Esempio n. 1
0
        public override void Write(char[] 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");
            }

            _sqlchars.Write(_lPosition, buffer, offset, count);
            _lPosition += count;
        }
Esempio n. 2
0
		public void Write_NullBufferAndInstanceValueTest ()
		{
			char [] c1 = null;
			SqlChars chars = new SqlChars();
			
			chars.Write (0, c1, 0, 10);
			Assert.Fail ("#9 Should throw ArgumentNullException");
		}
Esempio n. 3
0
		public void Write_NullInstanceValueTest ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			SqlChars chars = new SqlChars();

			chars.Write (0, c1, 0, 10);
			Assert.Fail ("#9 Should throw SqlTypeException");
		}
Esempio n. 4
0
		public void Write_NullBufferTest ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = null;
			SqlChars chars = new SqlChars (c1);

			chars.Write (0, c2, 0, 10);
			Assert.Fail ("#8 Should throw ArgumentNullException");
		}
Esempio n. 5
0
		public void Write_InvalidCountTest2 ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [10];
			SqlChars chars = new SqlChars (c2);

			chars.Write (8, c1, 0, (int) c1.Length);
			Assert.Fail ("#7 Should throw SqlTypeException");
		}
Esempio n. 6
0
		public void Write_InvalidCountTest1 ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [10];
			SqlChars chars = new SqlChars (c2);

			chars.Write (0, c1, 0, (int) c1.Length+5);
			Assert.Fail ("#6 Should throw ArgumentOutOfRangeException");
		}
Esempio n. 7
0
		public void Write_NegativeOffsetInBufferTest ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [10];
			SqlChars chars = new SqlChars (c2);

			chars.Write (0, c1, -1, (int) c1.Length);
			Assert.Fail ("#4 Should throw ArgumentOutOfRangeException");
		}
Esempio n. 8
0
		public void Write_InvalidOffsetInBufferTest ()
		{
            ExceptionAssert.Throws<ArgumentOutOfRangeException>(
		        delegate
		            {
		                char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
		                char [] c2 = new char [10];
		                SqlChars chars = new SqlChars (c2);

		                chars.Write (0, c1, c1.Length+5, (int) c1.Length);
		                Assert.Fail ("#5 Should throw ArgumentOutOfRangeException");
		            });
		}
Esempio n. 9
0
        public void Write_NegativeCountTest()
        {
            char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
            char[] c2 = new char[10];
            SqlChars chars = new SqlChars(c2);

            Assert.Throws<ArgumentOutOfRangeException>(() => chars.Write(0, c1, 0, -1));
        }
Esempio n. 10
0
        public void Write_NullInstanceValueTest()
        {
            char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
            SqlChars chars = new SqlChars();

            Assert.Throws<SqlTypeException>(() => chars.Write(0, c1, 0, 10));
        }
Esempio n. 11
0
        public void Write_NullBufferAndInstanceValueTest()
        {
            char[] c1 = null;
            SqlChars chars = new SqlChars();

            Assert.Throws<ArgumentNullException>(() => chars.Write(0, c1, 0, 10));
        }
Esempio n. 12
0
        public void Write_NullBufferTest()
        {
            char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
            char[] c2 = null;
            SqlChars chars = new SqlChars(c1);

            Assert.Throws<ArgumentNullException>(() => chars.Write(0, c2, 0, 10));
        }
Esempio n. 13
0
        public void Write_InvalidCountTest2()
        {
            char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
            char[] c2 = new char[10];
            SqlChars chars = new SqlChars(c2);

            Assert.Throws<SqlTypeException>(() => chars.Write(8, c1, 0, c1.Length));
        }
Esempio n. 14
0
        public void Write_InvalidOffsetInBufferTest()
        {
            char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
            char[] c2 = new char[10];
            SqlChars chars = new SqlChars(c2);

            Assert.Throws<ArgumentOutOfRangeException>(() => chars.Write(0, c1, c1.Length + 5, c1.Length));
        }
Esempio n. 15
0
		public void Write_SuccessTest2 ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [20];
			SqlChars chars = new SqlChars (c2);

			chars.Write (8, c1, 0, 10);
			Assert.AreEqual (chars.Value [8], c1 [0], "#10 Should be same");
			Assert.AreEqual (chars.Value [17], c1 [9], "#10 Should be same");
		}
Esempio n. 16
0
		public void Write_SuccessTest1 ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [10];
			SqlChars chars = new SqlChars (c2);

			chars.Write (0, c1, 0, (int) c1.Length);
			Assert.AreEqual (chars.Value [0], c1 [0], "#1 Should be same");
		}
Esempio n. 17
0
		public void Write_NegativeCountTest ()
		{
			char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			char [] c2 = new char [10];
			SqlChars chars = new SqlChars (c2);

			chars.Write (0, c1, 0, -1);
			Assert.Fail ("#11 Should throw ArgumentOutOfRangeException");
		}
Esempio n. 18
0
		public void Write_InvalidOffsetTest ()
		{
            ExceptionAssert.Throws<SqlTypeException>(
		        delegate
		            {
		                char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
		                char [] c2 = new char [10];
		                SqlChars chars = new SqlChars (c2);
			
		                chars.Write (chars.Length+5, c1, 0, (int) c1.Length);
		                Assert.Fail ("#3 Should throw SqlTypeException");
		            });
		}