示例#1
0
        public void WithBookmarkedLogCannotBeOpened_ThenPreviousFilesAreDeletedButNotLast()
        {
            GivenLogFilesInDirectory();
            Array.ForEach(LogFiles.Take(LogFiles.Length - 1).ToArray(), GivenFileDeleteSucceeds);
            var bookmarkedFile     = LogFiles.Last();
            var bookmarkedPosition = Fixture.Create <long>();

            GivenPersistedBookmark(bookmarkedFile, bookmarkedPosition);
            GivenLogReaderCreateIOError(CurrentLogFileName, CurrentLogFilePosition);

            WhenLogShipperIsCalled();

            this.ShouldSatisfyAllConditions(
                () => CurrentLogFileName.ShouldBe(bookmarkedFile, "Bookmarked log file name should not change"),
                () => CurrentLogFilePosition.ShouldBe(bookmarkedPosition, "Bookmarked position should not change"),
                () => LogFiles.ShouldBe(new[] { bookmarkedFile }, "Only one shall remain!")
                );
        }