Пример #1
0
        public void TestCtor1()
        {
            using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero))
            {
                proxy.InnerLogFile.Should().BeNull();
                proxy.MaxCharactersPerLine.Should().Be(0);
                proxy.Exists.Should().BeFalse();
                proxy.FileSize.Should().Be(Size.Zero);
                proxy.StartTimestamp.Should().NotHaveValue();
                proxy.Count.Should().Be(0);

                new Action(() => proxy.GetLine(0)).ShouldThrow<IndexOutOfRangeException>();
                new Action(() => proxy.GetSection(new LogFileSection(0, 1))).ShouldThrow<IndexOutOfRangeException>();
            }
        }
Пример #2
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);
            }
        }