コード例 #1
0
        public virtual void TestBasicsSkip()
        {
            ExactSizeInputStream s = new ExactSizeInputStream(ByteStream("hello"), 3);

            NUnit.Framework.Assert.AreEqual(3, s.Available());
            NUnit.Framework.Assert.AreEqual(2, s.Skip(2));
            NUnit.Framework.Assert.AreEqual(1, s.Skip(2));
            NUnit.Framework.Assert.AreEqual(0, s.Skip(2));
        }
コード例 #2
0
        public virtual void TestSkipNotEnough()
        {
            // Ask for 5 bytes, only has 2
            ExactSizeInputStream s = new ExactSizeInputStream(ByteStream("he"), 5);

            NUnit.Framework.Assert.AreEqual(2, s.Skip(3));
            try
            {
                s.Skip(1);
                NUnit.Framework.Assert.Fail("Skip when should be out of data");
            }
            catch (EOFException)
            {
            }
        }