public void TestParseEmptyDirectoryBlock() { var options = TestHelper.CreateFileSystemOptions(""); var b = new BlockParser(options); var b2 = new byte[options.BlockSize]; b.BytesToNode(b2); }
public void TestParseDirectoryBlock() { var options = TestHelper.CreateFileSystemOptions(""); var b = new BlockParser(options); var bb = new byte[options.BlockSize]; bb[0] = 1; Assert.IsInstanceOfType(b.BytesToNode(bb), typeof(Folder)); }
// NOTE: long parameter smell. Are they all needed? If yes: refactoring "introduce parameter object". public BlockList(IIndexNode node, BlockAllocation blockAllocation, FileSystemOptions options, BlockParser blockParser, BlockManipulator blockManipulator, Persistence persistence) { _node = node; _blockAllocation = blockAllocation; _options = options; _blockParser = blockParser; _blockManipulator = blockManipulator; _persistence = persistence; }
public VFSFileStream(VFSFile file, BlockParser blockParser, FileSystemOptions options, BlockAllocation blockAllocation, BlockManipulator blockManipulator, Persistence.Persistence persistence) { _file = file; _blockParser = blockParser; _options = options; _blockAllocation = blockAllocation; _blockManipulator = blockManipulator; _persistence = persistence; _writeBuffer = new byte[_options.BlockSize]; }
internal FileSystem(FileSystemOptions options) { _options = options; _blockManipulator = new BlockManipulator(_options.Location, _options.BlockSize, _options.MasterBlockSize); _blockParser = new BlockParser(_options); _persistence = new Persistence.Persistence(_blockParser, _blockManipulator); _blockAllocation = _options.BlockAllocation; InitializeFileSystem(); }
public void TestNameTooLong() { var f = new VFSFile("0123456789"); try { var o1 = TestHelper.CreateFileSystemOptions(""); o1.NameLength = f.Name.Length; var p1 = new BlockParser(o1); p1.NodeToBytes(f); } catch (VFSException) { Assert.Fail("Exception unexpected yet"); } var o2 = TestHelper.CreateFileSystemOptions(""); o2.NameLength = f.Name.Length - 1; var p2 = new BlockParser(o2); p2.NodeToBytes(f); }
public void TestParseTooSmallDirectoryBlock() { var options = TestHelper.CreateFileSystemOptions(""); var b = new BlockParser(options); var b1 = new byte[1024]; b.BytesToNode(b1); }
public void TestInvalidNode() { var options = TestHelper.CreateFileSystemOptions(""); var p = new BlockParser(options); p.NodeToBytes(new IndexNodeMock()); }
public void TestWriteFolderBlock() { var options = TestHelper.CreateFileSystemOptions(""); var b = new BlockParser(options); var f = new Folder("blubĪ±"); var bb = b.NodeToBytes(f); Assert.AreEqual(0x1, bb[0]); }
public void TestWriteAndPareseFolderBlock() { var options = TestHelper.CreateFileSystemOptions(""); var b = new BlockParser(options); const string name = "blubĪ±"; var f1 = new Folder(name); var bb = b.NodeToBytes(f1); var f2 = b.BytesToNode(bb); Assert.AreEqual(name, f2.Name); Assert.IsInstanceOfType(f2, typeof(Folder)); }
public Persistence(BlockParser blockParser, BlockManipulator blockManipulator) { _blockParser = blockParser; _blockManipulator = blockManipulator; }