Exemplo n.º 1
0
        private CompositeRawFile CreateRealCompositeRawFile(int fileChunkSize)
        {
            var bitHint = (int)Math.Ceiling(Math.Log(checked (fileChunkSize), 2));

            var f = new CompositeRawFile("testfile.d", bitHint,
                                         new CompositeFileFactory(), EFileAccess.ReadWrite, 0, 0, 0, EDataType.Data, 1);

            return(f);
        }
Exemplo n.º 2
0
        private static TxLog CreateTxLog()
        {
            var stubFileF = new CompositeFileFactory();

            _logfile = new CompositeRawFile(".\\_tx",
                                            MetadataConstants.PIPE_BIT_HINT, stubFileF,
                                            EFileAccess.ReadWrite, MetadataConstants.SYMBOL_PARTITION_ID,
                                            MetadataConstants.TX_LOG_FILE_ID, MetadataConstants.TX_LOG_FILE_ID, EDataType.Data);

            return(new TxLog(_logfile));
        }
Exemplo n.º 3
0
        private CompositeRawFile CreateCompositeRawFile(long fileLen, int fileChunkSize)
        {
            var bitHint = (int)Math.Ceiling(Math.Log(checked (fileChunkSize), 2));

            _copositeFileFactory = new Mock <ICompositeFileFactory>();
            _compositeFile       = new Mock <ICompositeFile>();
            _copositeFileFactory.Setup(c => c.OpenFile(It.IsAny <string>(), bitHint, EFileAccess.Read))
            .Returns(_compositeFile.Object);
            _compositeFile.Setup(m => m.CheckSize()).Returns(fileLen);

            var lengthFilePart = new Mock <IRawFilePart>();

            lengthFilePart.Setup(p => p.ReadInt64(0)).Returns(fileLen);
            _compositeFile.Setup(cf => cf.CreateViewAccessor(0, 8)).Returns(lengthFilePart.Object);

            var f = new CompositeRawFile("testfile.d", bitHint,
                                         _copositeFileFactory.Object, EFileAccess.Read, 0, 0, 0, EDataType.Data, 1);

            return(f);
        }