Exemplo n.º 1
0
        public void FlushWillFlushInnerStream()
        {
            var stream             = new TestStream();
            var fileSystem         = new FakeFileSystem(stream, null, null);
            var partitioningStream = new PartitioningFileStream(fileSystem, "FileName", "ext", 100, FileAccess.Read);

            partitioningStream.Flush();

            Assert.IsTrue(stream.HasCalledFlush);
        }
Exemplo n.º 2
0
        public void Write()
        {
            var memoryStream       = new MemoryStream();
            var fileSystem         = new FakeFileSystem(memoryStream, null, null);
            var partitioningStream = new PartitioningFileStream(fileSystem, "FileName", "ext", 100, FileAccess.Write);

            const string helloWorld = "Hello, World!";

            var buffer = Encoding.ASCII.GetBytes(helloWorld);

            partitioningStream.Write(buffer, 0, buffer.Length);
            partitioningStream.Flush();

            Assert.AreEqual(helloWorld, Encoding.ASCII.GetString(memoryStream.ToArray()));
        }