public void CanPinBuffer() { _buffersList = new TransactionBuffersList(_bufferManager); _ = _fileManager.Append(RandomFilename, out var block); Assert.DoesNotThrow(() => { _bufferManager.Pin(block); }); }
public void CanApplyLogToExistingFile() { var filename = RandomFilename; _fileManager.Append(filename, out _); _fileManager.Append(filename, out var block); Assert.DoesNotThrow(() => { _logManager = new LogManager(_fileManager, filename); }); }
/// <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); }
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); }
public bool Append(string filename, out Block block) { return(_fileManager.Append(filename, out block)); }