public void SetCharacterStream() { IClob testSubject = NewTestSubject(); if (testSubject.CanWrite) { TextWriter writer = testSubject.SetCharacterStream(1); writer.Write('a'); } try { TextWriter writer = testSubject.SetCharacterStream(0); Assert.Fail("successful invocation of SetCharacterStream(pos) with pos too small (<1)"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(HsqlDataSourceException), ex); } try { TextWriter writer = testSubject.SetCharacterStream(LobCharsLength + 1); Assert.Fail("successful invocation of SetCharacterStream(pos) with pos too large (LobCharsLength + 1)"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(HsqlDataSourceException), ex); } }
public void Free() { IClob testSubject = NewTestSubject(); long length = testSubject.Length; Assert.AreEqual(LobCharsLength, length); try { testSubject.Wrap("5678"); Assert.Fail("successful invocation of Wrap(object) before Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } testSubject.Free(); try { Stream stream = testSubject.GetAsciiStream(); Assert.Fail("successful invocation of GetAsciiStream() after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { TextReader reader = testSubject.GetCharacterStream(); Assert.Fail("successful invocation of GetCharactertream() after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { string chars = testSubject.GetSubString(0L, (int)length); Assert.Fail("successful invocation of GetSubString(long,int) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { long len = testSubject.Length; Assert.Fail("successful invocation of Length property after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { long pos = testSubject.Position("234", 1); Assert.Fail("successful invocation of Position(string,long) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { long pos = testSubject.Position(new JdbcClob("234"), 1); Assert.Fail("successful invocation of Position(IClob,long) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { Stream stream = testSubject.SetAsciiStream(1); Assert.Fail("successful invocation of SetAsciiStream(long) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { TextWriter writer = testSubject.SetCharacterStream(1); Assert.Fail("successful invocation of SetCharacterStream(long) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { testSubject.SetString(1, "234"); Assert.Fail("successful invocation of SetString(long,string) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { testSubject.SetString(1, "234", 0, 3); Assert.Fail("successful invocation of SetString(long,string,int,int) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { testSubject.Truncate(0); Assert.Fail("successful invocation of Truncate(long) after Free()"); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.IsInstanceOfType(typeof(InvalidOperationException), ex); } try { testSubject.Wrap("1234"); } catch (Exception ex) { Assert.Fail("Wrap(object) raised exception after Free(): " + ex.Message); } }