public void SqlBytesSetNull () { byte [] b1 = new byte [10]; SqlBytes bytes = new SqlBytes (b1); Assert.AreEqual (bytes.Length, 10, "#1 Should be same"); bytes.SetNull (); try { Assert.AreEqual (bytes.Length, 10, "#1 Should not be same"); Assert.Fail ("Should throw SqlNullValueException"); } catch (Exception ex) { Assert.AreEqual (typeof (SqlNullValueException), ex.GetType (), "Should throw SqlNullValueException"); } Assert.AreEqual (true, bytes.IsNull, "#2 Should be same"); }
public void SqlBytesSetNull() { byte[] b1 = new byte[10]; SqlBytes bytes = new SqlBytes(b1); Assert.Equal(bytes.Length, 10); bytes.SetNull(); try { Assert.Equal(bytes.Length, 10); Assert.False(true); } catch (Exception ex) { Assert.Equal(typeof(SqlNullValueException), ex.GetType()); } Assert.Equal(true, bytes.IsNull); }