Esempio n. 1
0
        public void SubRecordWriterTest01()
        {
            var writer = new DummyWriter();

            var buf = new byte[] { 0, Header(3, true, false), (byte)'=', Header(3, false, false), (byte)' ', (byte)'H', (byte)'a', Header(2, true, false), (byte)'l', Header(2, false, false), (byte)'o', (byte)' ', Header(3, true, true), (byte)'=',
                                   Header(4, false, true), (byte)'W', (byte)'e', (byte)'l', (byte)'t' };

            Assert.IsTrue(OdetteFtp.WriteToStreamInternal(writer, buf, buf.Length), "eor not reached.");

            writer.AssertData(
                new byte[][]
            {
                new byte[] { (byte)'=', (byte)'=', (byte)'=', (byte)' ', (byte)'H', (byte)'a', (byte)'l', (byte)'l', (byte)'o', (byte)' ', (byte)'=', (byte)'=', (byte)'=' },
                new byte[] { (byte)'W', (byte)'e', (byte)'l', (byte)'t' }
            }
                );
        }         // proc SubRecordWriterTest01
Esempio n. 2
0
        }         // class DummyWriter

        private void TestSubRecordChain(byte[][] src, bool allowCompressing, int bufferSize)
        {
            var reader = new DummyReader(src);
            var writer = new DummyWriter();
            var buffer = new byte[bufferSize];
            int filledBuffer;

            while (true)
            {
                var eos = OdetteFtp.FillFromStreamInternal(reader, allowCompressing, buffer, out filledBuffer);
                OdetteFtp.WriteToStreamInternal(writer, buffer, filledBuffer);
                if (eos)
                {
                    break;
                }
            }

            writer.AssertData(src);
        }         // proc TestSubRecordChain