public void Open_FileExist_ReturnsFileStream() { Rofs fs = new Rofs(disk); Stream abc = fs.Open("Abc"); Assert.AreEqual(3, abc.Length); Assert.AreEqual(1, abc.ReadByte()); Assert.AreEqual(2, abc.ReadByte()); Assert.AreEqual(3, abc.ReadByte()); Stream def = fs.Open("Def"); Assert.AreEqual(3, def.Length); Assert.AreEqual(4, def.ReadByte()); Assert.AreEqual(5, def.ReadByte()); Assert.AreEqual(6, def.ReadByte()); }
private void OpenBtn_Click(object sender, EventArgs e) { if (openRofsOfd.ShowDialog() == DialogResult.OK) { var fss = File.Open(openRofsOfd.FileName, FileMode.OpenOrCreate); var fs = new Rofs(fss); foreach (var file in fs.GetFiles()) { Files.Add(file.Name, fs.Open(file.Name)); filenamesLb.Items.Add(file.Name); } fss.Dispose(); } }
public void Open_FileDoesNotExist_ThrowsException() { Rofs fs = new Rofs(disk); Assert.ThrowsException <FileNotFoundException>(() => fs.Open("Ghi")); }