protected void GivenPersistedBookmark(string logFileName = null, long position = 0)
        {
            CurrentLogFileName     = logFileName;
            CurrentLogFilePosition = position;

            PersistedBookmark = _mockRepository.Create <IPersistedBookmark>();
            PersistedBookmark.Setup(x => x.Dispose()).Callback(() => PersistedBookmark.Reset());
            PersistedBookmark.SetupGet(x => x.FileName).Returns(() => CurrentLogFileName);
            PersistedBookmark.SetupGet(x => x.Position).Returns(() => CurrentLogFilePosition);
            PersistedBookmark.Setup(x => x.UpdatePosition(It.IsAny <long>()))
            .Callback((long pos) => { CurrentLogFilePosition = pos; });
            PersistedBookmark.Setup(x => x.UpdateFileNameAndPosition(It.IsAny <string>(), It.IsAny <long>()))
            .Callback((string fileName, long pos) =>
            {
                CurrentLogFileName     = fileName;
                CurrentLogFilePosition = pos;
            });

            PersistedBookmarkFactory
            .Setup(
                x => x.Create(It.Is <string>(s => s == Options.Object.BufferBaseFilename + ".bookmark"))
                )
            .Returns(PersistedBookmark.Object);
        }
 protected void GivenPersistedBookmarkFilePermissionsError()
 {
     PersistedBookmarkFactory
     .Setup(x => x.Create(It.Is <string>(s => s == Options.Object.BufferBaseFilename + ".bookmark")))
     .Throws <UnauthorizedAccessException>();
 }
 protected void GivenPersistedBookmarkIsLocked()
 {
     PersistedBookmarkFactory
     .Setup(x => x.Create(It.Is <string>(s => s == Options.Object.BufferBaseFilename + ".bookmark")))
     .Throws <IOException>();
 }