예제 #1
0
 public void TestGetLine()
 {
     using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero, _logFile.Object))
     {
         proxy.GetLine(42);
         _logFile.Verify(l => l.GetLine(It.Is <int>(x => x == 42)), Times.Once);
     }
 }
예제 #2
0
        public void TestEmptyConstruction()
        {
            using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero))
            {
                proxy.InnerLogFile.Should().BeNull();
                proxy.MaxCharactersPerLine.Should().Be(0);
                proxy.GetValue(LogFileProperties.EmptyReason).Should().Be(ErrorFlags.SourceDoesNotExist);
                proxy.GetValue(LogFileProperties.Size).Should().BeNull();
                proxy.GetValue(LogFileProperties.StartTimestamp).Should().NotHaveValue();
                proxy.GetValue(LogFileProperties.EndTimestamp).Should().NotHaveValue();
                proxy.Count.Should().Be(0);
                proxy.Columns.Should().Equal(LogFileColumns.Minimum);

                new Action(() => proxy.GetLine(0)).ShouldThrow <IndexOutOfRangeException>();
                new Action(() => proxy.GetSection(new LogFileSection(0, 1))).ShouldThrow <IndexOutOfRangeException>();
            }
        }