public void Test1Line([Values(1, 2, 3)] int numReadOperations)
        {
            var fileName = @"TestData\1Line.txt";
            var info     = FileFingerprint.FromFile(_filesystem, fileName);

            var logFile = Create(fileName, Encoding.Default);

            _taskScheduler.Run(numReadOperations);

            logFile.GetProperty(TextProperties.LineCount).Should().Be(1);
            logFile.GetProperty(Properties.LogEntryCount).Should().Be(1);
            logFile.GetProperty(Properties.Size).Should().Be(Size.FromBytes(109));
            logFile.GetProperty(Properties.PercentageProcessed).Should().Be(Percentage.HundredPercent);

            var indices = logFile.GetColumn(new LogSourceSection(0, 1), StreamingTextLogSource.LineOffsetInBytes);

            indices[0].Should().Be(0, "because the first line starts at an offset of 0 bytes wrt the start of the file");

            var entries = GetEntries(logFile);

            entries.Should().HaveCount(1);
            entries.Columns.Should().Equal(new IColumnDescriptor[] { Columns.Index, StreamingTextLogSource.LineOffsetInBytes, Columns.RawContent });
            entries[0].Index.Should().Be(0);
            entries[0].RawContent.Should().Be(@"[00:00:01] git clone -q --branch=master https://github.com/Kittyfisto/SharpRemote.git C:\projects\sharpremote");
        }
        public void Test2Lines()
        {
            // TODO: Rename to 3 lines because that filename is just plain wrong
            var fileName = @"TestData\2Lines.txt";
            var info     = FileFingerprint.FromFile(_filesystem, fileName);

            var logFile = Create(fileName, Encoding.UTF8);

            _taskScheduler.RunOnce();

            logFile.GetProperty(TextProperties.LineCount).Should().Be(3, "because there's 3 lines, the last one is empty though");
            logFile.GetProperty(Properties.LogEntryCount).Should().Be(3, "because there's 3 lines, the last one is empty though");
            logFile.GetProperty(Properties.Size).Should().Be(Size.FromBytes(new FileInfo(fileName).Length));             //< Git f***s with the file length due to replacing line endings => we can't hard code it here
            logFile.GetProperty(Properties.PercentageProcessed).Should().Be(Percentage.HundredPercent);

            var indices = logFile.GetColumn(new LogSourceSection(0, 3), StreamingTextLogSource.LineOffsetInBytes);

            indices[0].Should().Be(3, "because the first line starts right after the preamble (also called byte order mark, BOM), which, for UTF-8, is 3 bytes long");
            indices[1].Should().BeInRange(165L, 166L, "because git f***s with line endings and thus the offset might differ");

            var entries = GetEntries(logFile);

            entries.Should().HaveCount(3);
            entries.Columns.Should().Equal(new IColumnDescriptor[] { Columns.Index, StreamingTextLogSource.LineOffsetInBytes, Columns.RawContent });
            entries[0].Index.Should().Be(0);
            entries[0].RawContent.Should().Be("2015-10-07 19:50:58,981 [8092, 1] INFO  SharpRemote.Hosting.OutOfProcessSiloServer (null) - Silo Server starting, args (1): \"14056\", without custom type resolver");
            entries[1].Index.Should().Be(1);
            entries[1].RawContent.Should().Be("2015-10-07 19:50:58,997 [8092, 1] DEBUG SharpRemote.Hosting.OutOfProcessSiloServer (null) - Args.Length: 1");
        }
        public void TestEmptyFile([Values(1, 2, 3)] int numReadOperations)
        {
            var fileName = @"TestData\Empty.txt";
            var info     = FileFingerprint.FromFile(_filesystem, fileName);

            var logFile = Create(fileName, Encoding.Default);

            _taskScheduler.Run(numReadOperations);
            logFile.GetProperty(TextProperties.LineCount).Should().Be(0, "because the file is empty");
            logFile.GetProperty(Properties.LogEntryCount).Should().Be(0, "because the file is empty");
            logFile.GetProperty(Properties.Size).Should().Be(Size.Zero, "because the file is empty");
            logFile.GetProperty(Properties.Created).Should().Be(info.Created);
            logFile.GetProperty(Properties.LastModified).Should().Be(info.LastModified);
            logFile.GetProperty(Properties.EmptyReason).Should().Be(null, "because the source file does exist and can be accessed");
            logFile.GetProperty(Properties.PercentageProcessed).Should().Be(Percentage.HundredPercent, "because we've checked that the source doesn't exist and thus there's nothing more to process");

            var indices = logFile.GetColumn(new LogSourceSection(0, 1), StreamingTextLogSource.LineOffsetInBytes);

            indices[0].Should().Be(StreamingTextLogSource.LineOffsetInBytes.DefaultValue);

            var entries = GetEntries(logFile);

            entries.Should().BeEmpty();
        }