コード例 #1
0
        public void readIntoBufferWithOffsetAfterDispose()
        {
            JavaInputStreamAdapter testSubject = NewTestSubject("asdf", Encoding.ASCII);

            testSubject.Dispose();

            byte[] buff = new byte[2];

            try
            {
                testSubject.read(buff, 1, 2);
            }
            catch (Exception ex)
            {
                java.io.IOException ioe = ex as java.io.IOException;

                if (ioe != null)
                {
                    System.Exception cause = ioe.getCause();
                    Assert.IsNotNull(cause);
                    Assert.IsInstanceOfType(typeof(System.ObjectDisposedException), cause);
                }

                throw;
            }
        }
コード例 #2
0
        public void skipAfterDispose()
        {
            JavaInputStreamAdapter testSubject = NewTestSubject("asdf", Encoding.ASCII);

            testSubject.Dispose();

            try
            {
                testSubject.skip(1);
            }
            catch (Exception ex)
            {
                java.io.IOException ioe = ex as java.io.IOException;

                if (ioe != null)
                {
                    System.Exception cause = ioe.getCause();
                    Assert.IsNotNull(cause);
                    Assert.IsInstanceOfType(typeof(System.ObjectDisposedException), cause);
                }

                throw;
            }
        }