예제 #1
0
        public void TestGetSection()
        {
            using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero, _logFile.Object))
            {
                proxy.GetSection(new LogFileSection(42, 101), new LogLine[101]);

                var expected = new LogFileSection(42, 101);
                _logFile.Verify(l => l.GetSection(It.Is <LogFileSection>(x => Equals(x, expected)),
                                                  It.IsAny <LogLine[]>()), 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>();
            }
        }