Esempio n. 1
0
        public void TestInvalidate1()
        {
            var notifier = new LogSourceListenerNotifier(_logFile.Object, _listener.Object, TimeSpan.Zero, 1);

            notifier.OnRead(1);
            notifier.Remove(0, 1);
            _modifications.Should().Equal(new[]
            {
                LogSourceModification.Reset(),
                LogSourceModification.Appended(0, 1),
                LogSourceModification.Removed(0, 1)
            });
            notifier.LastNumberOfLines.Should().Be(0);
        }
Esempio n. 2
0
        public void TestInvalidate2()
        {
            var notifier = new LogSourceListenerNotifier(_logFile.Object, _listener.Object, TimeSpan.FromSeconds(1), 10);

            notifier.OnRead(10);
            notifier.OnRead(12);
            notifier.Remove(0, 12);
            _modifications.Should().Equal(new[]
            {
                LogSourceModification.Reset(),
                LogSourceModification.Appended(0, 10),
                LogSourceModification.Removed(0, 10)
            },
                                          "Because the notifier should've reported only the first 10 changes and therefore Invalidate() only had to invalidate those 10 changes"
                                          );
            notifier.LastNumberOfLines.Should().Be(0);
        }