本文整理汇总了C#中System.Data.SqlTypes.SqlChars.Read方法的典型用法代码示例。如果您正苦于以下问题:C# SqlChars.Read方法的具体用法?C# SqlChars.Read怎么用?C# SqlChars.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlTypes.SqlChars
的用法示例。
在下文中一共展示了SqlChars.Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read_NullBufferAndInstanceValueTest
public void Read_NullBufferAndInstanceValueTest ()
{
char [] c2 = null;
SqlChars chars = new SqlChars ();
chars.Read (0, c2, 8, 4);
}
示例2: Read_NegativeCountTest
public void Read_NegativeCountTest ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [5];
chars.Read (0, c2, 0, -1);
Assert.Fail ("#11 Should throw ArgumentOutOfRangeException");
}
示例3: Read_NullInstanceValueTest
public void Read_NullInstanceValueTest ()
{
char [] c2 = new char [5];
SqlChars chars = new SqlChars ();
chars.Read (0, c2, 8, 4);
Assert.Fail ("#7 Should throw SqlNullValueException");
}
示例4: Read_SuccessTest2
public void Read_SuccessTest2 ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [10];
chars.Read (5, c2, 0, 10);
Assert.AreEqual (chars.Value [5], c2 [0], "#8 Should be same");
Assert.AreEqual (chars.Value [9], c2 [4], "#9 Should be same");
}
示例5: Read_NullBufferTest
public void Read_NullBufferTest ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = null;
chars.Read (0, c2, 0, 10);
Assert.Fail ("#2 Should throw ArgumentNullException");
}
示例6: Read_InvalidOffsetInBufferTest
public void Read_InvalidOffsetInBufferTest ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [5];
chars.Read (0, c2, 8, 4);
Assert.Fail ("#6 Should throw ArgumentOutOfRangeException");
}
示例7: SetSqlChars_Unchecked
private static void SetSqlChars_Unchecked(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlChars value, int offset, int length)
{
if (value.IsNull)
{
setters.SetDBNull(sink, ordinal);
sink.ProcessMessagesAndThrow();
}
else
{
int num4;
long num5;
if ((length > 0xfa0) || (length < 0))
{
num4 = 0xfa0;
}
else
{
num4 = length;
}
char[] buffer = new char[num4];
long num2 = 1L;
long num = offset;
for (long i = 0L; ((length < 0) || (i < length)) && ((0L != (num5 = value.Read(num, buffer, 0, num4))) && (0L != num2)); i += num2)
{
num2 = setters.SetChars(sink, ordinal, num, buffer, 0, (int) num5);
sink.ProcessMessagesAndThrow();
num += num2;
}
setters.SetCharsLength(sink, ordinal, num);
sink.ProcessMessagesAndThrow();
}
}
示例8: Read_NegativeOffsetInBufferTest
public void Read_NegativeOffsetInBufferTest ()
{
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
delegate
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [5];
chars.Read (0, c2, -1, 4);
Assert.Fail ("#5 Should throw ArgumentOutOfRangeException");
});
}
示例9: Read_NullBufferAndInstanceValueTest
public void Read_NullBufferAndInstanceValueTest()
{
char[] c2 = null;
SqlChars chars = new SqlChars();
Assert.Throws<SqlNullValueException>(() => chars.Read(0, c2, 8, 4));
}
示例10: Read_InvalidCountTest2
public void Read_InvalidCountTest2()
{
char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars(c1);
char[] c2 = new char[5];
Assert.Throws<ArgumentOutOfRangeException>(() => chars.Read(0, c2, 3, 4));
}
示例11: Read_NegativeOffsetInBufferTest
public void Read_NegativeOffsetInBufferTest()
{
char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars(c1);
char[] c2 = new char[5];
Assert.Throws<ArgumentOutOfRangeException>(() => chars.Read(0, c2, -1, 4));
}
示例12: Read_NullBufferTest
public void Read_NullBufferTest()
{
char[] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars(c1);
char[] c2 = null;
Assert.Throws<ArgumentNullException>(() => chars.Read(0, c2, 0, 10));
}
示例13: Read_NullBufferAndInstanceValueTest
public void Read_NullBufferAndInstanceValueTest ()
{
char [] c2 = null;
SqlChars chars = new SqlChars ();
chars.Read (0, c2, 8, 4);
Assert.Fail ("#10 Should throw ArgumentNullException");
}
示例14: Read_InvalidCountTest2
public void Read_InvalidCountTest2 ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [5];
chars.Read (0, c2, 3, 4);
Assert.Fail ("#12 Should throw ArgumentOutOfRangeException");
}
示例15: Read_SuccessTest1
public void Read_SuccessTest1 ()
{
char [] c1 = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
SqlChars chars = new SqlChars (c1);
char [] c2 = new char [10];
chars.Read (0, c2, 0, (int) chars.Length);
Assert.AreEqual (chars.Value [5], c2 [5], "#1 Should be equal");
}