public virtual void GetObjectData() { int[] expected = new int[] { 1, 1, 2, 1 }; Type type = typeof(HsqlBatchUpdateException); FormatterConverter converter = new FormatterConverter(); SerializationInfo info = new SerializationInfo(type, converter); StreamingContext context = new StreamingContext(); HsqlBatchUpdateException exception = new HsqlBatchUpdateException(expected); exception.GetObjectData(info, context); int[] actual = (int[]) info.GetValue("UpdateCounts", typeof(int[])); Assert.AreEqual(expected.Length, actual.Length); for (int i = 0; i < actual.Length; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public virtual void GetObjectData() { int[] expected = new int[] { 1, 1, 2, 1 }; Type type = typeof(HsqlBatchUpdateException); FormatterConverter converter = new FormatterConverter(); SerializationInfo info = new SerializationInfo(type, converter); StreamingContext context = new StreamingContext(); HsqlBatchUpdateException exception = new HsqlBatchUpdateException(expected); exception.GetObjectData(info, context); int[] actual = (int[])info.GetValue("UpdateCounts", typeof(int[])); Assert.AreEqual(expected.Length, actual.Length); for (int i = 0; i < actual.Length; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public void ErrorCode() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); }
public void ErrorCode() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(HsqlBatchUpdateException.VendorCode, testSubect.ErrorCode); }
public void SqlState() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); string state = org.hsqldb.Trace.error(HsqlBatchUpdateException.VendorCode).getSQLState(); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(state, testSubect.SqlState); }
public void Message() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); string baseMessage = org.hsqldb.Trace.getMessage( -HsqlBatchUpdateException.VendorCode) + " - Batch update failed"; Assert.AreEqual(baseMessage, testSubect.Message); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(baseMessage, testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); }
public void Message() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); string baseMessage = org.hsqldb.Trace.getMessage( -HsqlBatchUpdateException.VendorCode) + " - Batch update failed"; Assert.AreEqual(baseMessage, testSubect.Message); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(baseMessage, testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(baseMessage + " : additional message.", testSubect.Message); }
public void UpdateCounts() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(1, testSubect.UpdateCounts.Length); Assert.AreEqual(1, testSubect.UpdateCounts[0]); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(1, testSubect.UpdateCounts.Length); Assert.AreEqual(1, testSubect.UpdateCounts[0]); }
public void SqlState() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); string state = org.hsqldb.Trace.error(HsqlBatchUpdateException.VendorCode).getSQLState(); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(state, testSubect.SqlState); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(state, testSubect.SqlState); }
public void UpdateCounts() { HsqlBatchUpdateException testSubect = new HsqlBatchUpdateException(); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException(new int[] { 1 }); Assert.AreEqual(1, testSubect.UpdateCounts.Length); Assert.AreEqual(1, testSubect.UpdateCounts[0]); testSubect = new HsqlBatchUpdateException("additional message."); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException("additional message.", new InvalidOperationException()); Assert.AreEqual(0, testSubect.UpdateCounts.Length); testSubect = new HsqlBatchUpdateException("additional message.", new int[] { 1 }); Assert.AreEqual(1, testSubect.UpdateCounts.Length); Assert.AreEqual(1, testSubect.UpdateCounts[0]); }