Exemple #1
0
        public void WriteByte_Sync_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]);
                f.Write(0, testData[0]);
                f.Write(1, testData[1]);
                f.Write(2, testData[2]);
                f.Write(3, testData[3]);
                f.Write(4, testData[4]);
                f.Write(5, testData[5]);
                f.Write(6, testData[6]);
                f.Write(7, testData[7]);
                Assert.AreEqual(testData[0], f.Read(0));
                Assert.AreEqual(testData[1], f.Read(1));
                Assert.AreEqual(testData[2], f.Read(2));
                Assert.AreEqual(testData[3], f.Read(3));
                Assert.AreEqual(testData[4], f.Read(4));
                Assert.AreEqual(testData[5], f.Read(5));
                Assert.AreEqual(testData[6], f.Read(6));
                Assert.AreEqual(testData[7], f.Read(7));
            }
        }
Exemple #2
0
        public async Task Write_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]);
                f.Write(testData);
                Assert.IsTrue(testData.SequenceEqual(await f.ReadAsync()));
            }
        }
Exemple #3
0
        public void Write_Sync_Memory()
        {
            var testData = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };

            using (var f = new GenericFile())
            {
                f.EnableInMemoryLoad = true;
                f.CreateFile(new byte[8]);
                f.Write(testData);
                Assert.IsTrue(testData.SequenceEqual(f.Read()));
            }
        }