Ejemplo n.º 1
0
        public void CanPinBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            _ = _fileManager.Append(RandomFilename, out var block);

            Assert.DoesNotThrow(() =>
            {
                _bufferManager.Pin(block);
            });
        }
Ejemplo n.º 2
0
        public void CanApplyLogToExistingFile()
        {
            var filename = RandomFilename;

            _fileManager.Append(filename, out _);
            _fileManager.Append(filename, out var block);

            Assert.DoesNotThrow(() =>
            {
                _logManager = new LogManager(_fileManager, filename);
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Log exception.
        /// </summary>
        /// <param name="ex">Exception.</param>
        /// <param name="caller">Used to get method caller (use <c>nameof</c> to get constructor name).</param>
        public static void Log(Exception ex, [CallerMemberName] string caller = "")
        {
            checkFiles();

            if (!logFileExists() || ex == null)
            {
                return;
            }

            var throwDate = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss");
            var message   = $"[{throwDate}] Exception: '{ex.Message}' > target method: {caller}\n";

            FileManager.Append(LogsFilePath, message);
        }
Ejemplo n.º 4
0
        public void CanAppendMemoryBlock()
        {
            var filename  = RandomFilename;
            var canAppend = _fileManager.Append(filename, out var block);

            Assert.True(canAppend);
            Assert.AreEqual(0, block.Id);
            Assert.AreEqual(filename, block.Filename);
        }
Ejemplo n.º 5
0
Archivo: Page.cs Proyecto: SaberMK/BiBi
 public bool Append(string filename, out Block block)
 {
     return(_fileManager.Append(filename, out block));
 }