Ejemplo n.º 1
0
        public async Task WriteByte_Sequence_Async_Stream()
        {
            var testData = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };

            using (var f = new GenericFile())
            {
                f.EnableInMemoryLoad = false;
                f.CreateFile(new byte[8]);
                await f.WriteByteAsync(testData[0]);

                await f.WriteByteAsync(testData[1]);

                await f.WriteByteAsync(testData[2]);

                await f.WriteByteAsync(testData[3]);

                await f.WriteByteAsync(testData[4]);

                await f.WriteByteAsync(testData[5]);

                await f.WriteByteAsync(testData[6]);

                await f.WriteByteAsync(testData[7]);

                Assert.AreEqual(testData[0], await f.ReadAsync(0));
                Assert.AreEqual(testData[1], await f.ReadAsync(1));
                Assert.AreEqual(testData[2], await f.ReadAsync(2));
                Assert.AreEqual(testData[3], await f.ReadAsync(3));
                Assert.AreEqual(testData[4], await f.ReadAsync(4));
                Assert.AreEqual(testData[5], await f.ReadAsync(5));
                Assert.AreEqual(testData[6], await f.ReadAsync(6));
                Assert.AreEqual(testData[7], await f.ReadAsync(7));
            }
        }