Exemple #1
0
        protected override void OnSingleLineChanged()
        {
            _multiLineLogFile?.Dispose();

            if (!IsSingleLine)
            {
                _multiLineLogFile = new MultiLineLogFile(TaskScheduler, _originalLogFile, MaximumWaitTime);
                _unfilteredLogFile.InnerLogFile = _multiLineLogFile;
            }
            else
            {
                _unfilteredLogFile.InnerLogFile = _originalLogFile;
            }
        }
Exemple #2
0
        public void TestCtor1()
        {
            var logFile = new MultiLineLogFile(_taskScheduler, _source.Object, TimeSpan.Zero);

            _taskScheduler.PeriodicTaskCount.Should().Be(1);

            logFile.Dispose();
            _taskScheduler.PeriodicTaskCount.Should().Be(0);
        }
Exemple #3
0
        public void TestCtor2()
        {
            var logFile = new MultiLineLogFile(_taskScheduler, _source.Object, TimeSpan.Zero);

            _source.Verify(
                x => x.AddListener(It.Is <ILogFileListener>(y => Equals(y, logFile)), It.IsAny <TimeSpan>(), It.IsAny <int>()),
                Times.Once,
                "because the single line log file should register itself as a source at the listener");

            new Action(() => logFile.Dispose()).ShouldNotThrow("because Dispose() must always succeed");
            _source.Verify(x => x.RemoveListener(It.Is <ILogFileListener>(y => Equals(y, logFile))), Times.Once,
                           "because the single line log file should remove itself as a listener from its source upon being disposed of");
        }