Public feed
#721583
[Test]
public void ReadTest1()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[10];
bytes.Read(0, b2, 0, (int)bytes.Length);
Assert.AreEqual(bytes.Value[5], b2[5], "#1 Should be equal");
}
[Test]
public void ReadTest2()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = null;
try
{
bytes.Read(0, b2, 0, 10);
Assert.Fail("#2 Should throw ArgumentNullException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(ArgumentNullException), e.GetType(), "#2 Should throw ArgumentNullException");
}
}
[Test]
public void ReadTest3 ()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[5];
try
{
bytes.Read(0, b2, 0, 10);
Assert.Fail("#2 Should throw ArgumentOutOfRangeException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(ArgumentOutOfRangeException), e.GetType(), "#2 Should throw ArgumentOutOfRangeException");
}
}
[Test]
public void ReadTest4()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[5];
try
{
bytes.Read(-1, b2, 0, 4);
Assert.Fail("#2 Should throw ArgumentOutOfRangeException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(ArgumentOutOfRangeException), e.GetType(), "#2 Should throw ArgumentOutOfRangeException");
}
}
[Test]
public void ReadTest5()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[5];
try
{
bytes.Read(0, b2, -1, 4);
Assert.Fail("#2 Should throw ArgumentOutOfRangeException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(ArgumentOutOfRangeException), e.GetType(), "#2 Should throw ArgumentOutOfRangeException");
}
}
[Test]
public void ReadTest6()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[5];
try
{
bytes.Read(0, b2, 8, 4);
Assert.Fail("#2 Should throw ArgumentOutOfRangeException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(ArgumentOutOfRangeException), e.GetType(), "#2 Should throw ArgumentOutOfRangeException");
}
}
[Test]
public void ReadTest7()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes();
byte[] b2 = new byte[5];
try
{
bytes.Read(0, b2, 8, 4);
Assert.Fail("#2 Should throw SqlNullValueException");
}
catch (Exception e)
{
Assert.AreEqual(typeof(SqlNullValueException), e.GetType(), "#2 Should throw SqlNullValueException");
}
}
[Test]
public void ReadTest8()
{
byte[] b1 = { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 };
SqlBytes bytes = new SqlBytes(b1);
byte[] b2 = new byte[10];
bytes.Read(5, b2, 0, 10);
Assert.AreEqual(bytes.Value[5], b2[0], "#1 Should be same");
Assert.AreEqual(bytes.Value[9], b2[4], "#2 Should be same");
}