Exemplo n.º 1
0
 public void ReadDoNotChangeParentCursorTest()
 {
     SliceStream.Position = 2;
     SliceStream.ReadByte();
     Assert.AreEqual(3, SliceStream.Position);
     Assert.AreEqual(0, BaseStream.Position);
 }
Exemplo n.º 2
0
        public void SliceOfSliceMatchesCorrectOffset2Param()
        {
            using (FileStream fs = new FileStream("src/Stream/data/SimpleStream.txt", FileMode.Open))
            {
                SliceStream slice1 = new SliceStream(fs, 1, fs.Length - 2);
                SliceStream slice2 = new SliceStream(slice1, 1, slice1.Length - 2);

                fs.Seek(2, SeekOrigin.Begin);
                slice1.Seek(1, SeekOrigin.Begin);

                int data, data1, data2;
                data  = fs.ReadByte();
                data1 = slice1.ReadByte();
                data2 = slice2.ReadByte();

                // Reads through different slices at corresponding offsets should match up
                Assert.AreEqual(data, data1);
                Assert.AreEqual(data, data2);
            }
        }