Exemplo n.º 1
0
 public void TestParseEmptyDirectoryBlock()
 {
     var options = TestHelper.CreateFileSystemOptions("");
     var b = new BlockParser(options);
     var b2 = new byte[options.BlockSize];
     b.BytesToNode(b2);
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 // 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;
 }
Exemplo n.º 4
0
        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];
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 public void TestParseTooSmallDirectoryBlock()
 {
     var options = TestHelper.CreateFileSystemOptions("");
     var b = new BlockParser(options);
     var b1 = new byte[1024];
     b.BytesToNode(b1);
 }
Exemplo n.º 8
0
 public void TestInvalidNode()
 {
     var options = TestHelper.CreateFileSystemOptions("");
     var p = new BlockParser(options);
     p.NodeToBytes(new IndexNodeMock());
 }
Exemplo n.º 9
0
        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]);
        }
Exemplo n.º 10
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));
        }
Exemplo n.º 11
0
 public Persistence(BlockParser blockParser, BlockManipulator blockManipulator)
 {
     _blockParser = blockParser;
     _blockManipulator = blockManipulator;
 }