本文整理汇总了C#中System.Data.SqlTypes.SqlBytes.Write方法的典型用法代码示例。如果您正苦于以下问题:C# SqlBytes.Write方法的具体用法?C# SqlBytes.Write怎么用?C# SqlBytes.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlTypes.SqlBytes
的用法示例。
在下文中一共展示了SqlBytes.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write_NullBufferAndInstanceValueTest
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");
});
}
示例2: Write_NullBufferTest
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");
});
}
示例3: Write_NullInstanceValueTest
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");
});
}
示例4: Write_InvalidCountTest1
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");
});
}
示例5: Write_InvalidCountTest2
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");
});
}
示例6: Write_InvalidCountTest2
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));
}
示例7: Write_NegativeOffsetInBufferTest
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");
});
}
示例8: Write_InvalidOffsetTest
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");
}
示例9: Write_InvalidOffsetInBufferTest
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");
}
示例10: Write_NegativeCountTest
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));
}
示例11: Write_NegativeOffsetTest
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");
}
示例12: Write_NullBufferAndInstanceValueTest
public void Write_NullBufferAndInstanceValueTest()
{
byte[] b1 = null;
SqlBytes bytes = new SqlBytes();
Assert.Throws<ArgumentNullException>(() => bytes.Write(0, b1, 0, 10));
}
示例13: Write_NullInstanceValueTest
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));
}
示例14: Write_NullBufferTest
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));
}
示例15: Write_SuccessTest2
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");
}