Ejemplo 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(OdetteFtpCore.WriteToStreamInternalAsync(writer, buf, buf.Length).Result, "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
Ejemplo 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];

            while (true)
            {
                var eos = OdetteFtpCore.FillFromStreamInternalAsync(reader, allowCompressing, buffer).Result;
                OdetteFtpCore.WriteToStreamInternalAsync(writer, buffer, eos.dataLength).Wait();
                if (eos.endOfStream)
                {
                    break;
                }
            }

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