Exemple #1
0
        public void TestInvalidate()
        {
            var collection = new LogFileListenerCollection(new Mock <ILogFile>().Object);

            collection.OnRead(1);
            collection.CurrentLineIndex.Should().Be(1);
            collection.Invalidate(0, 1);
            collection.CurrentLineIndex.Should().Be(0);
        }
        public void TestListen3()
        {
            using (var proxy = new LogFileProxy(_scheduler, TimeSpan.Zero, _logFile.Object))
            {
                proxy.AddListener(_listener.Object, TimeSpan.Zero, 1000);

                _listeners.OnRead(500);
                _listeners.Invalidate(400, 100);
                _listeners.OnRead(550);

                _scheduler.RunOnce();

                _modifications.Should().Equal(new[]
                {
                    LogFileSection.Reset,
                    new LogFileSection(0, 500),
                    LogFileSection.Invalidate(400, 100),
                    new LogFileSection(400, 150)
                });
            }
        }