Ejemplo n.º 1
0
        public void BasicReadTest()
        {
            var first  = new MemoryStream(new[] { (byte)1 });
            var second = new MemoryStream(new[] { (byte)2 });

            var composite = new CompositingStream(first, second);

            byte[] buffer    = new byte[2];
            var    readBytes = composite.Read(buffer, 0, 2);

            Assert.AreEqual(2, readBytes);
            Assert.AreEqual(1, buffer[0]);
            Assert.AreEqual(2, buffer[1]);
        }
Ejemplo n.º 2
0
        public void EmptyStreamIgnoredOnRead()
        {
            var first  = new MemoryStream(new[] { (byte)1 });
            var empty  = new MemoryStream(new byte[0]);
            var second = new MemoryStream(new[] { (byte)2 });

            var composite = new CompositingStream(first, empty, second);

            byte[] buffer    = new byte[2];
            var    readBytes = composite.Read(buffer, 0, 2);

            Assert.AreEqual(2, readBytes);
            Assert.AreEqual(1, buffer[0]);
            Assert.AreEqual(2, buffer[1]);
        }