Пример #1
0
        public void TestOneLogFile()
        {
            var logFile = new InMemoryLogFile();

            logFile.SetValue(LogFileProperties.Name, "Hello there.txt");

            var analyser = new DataSourcesAnalyser(AnalyserId.Empty, TimeSpan.Zero);

            analyser.Progress.Should().Be(Percentage.HundredPercent);

            analyser.OnLogFileAdded(DataSourceId.Empty, logFile);
            analyser.Result.Should().NotBeNull();
            analyser.Result.Should().BeOfType <DataSourcesResult>();
            var result = (DataSourcesResult)analyser.Result;

            result.DataSources.Should().HaveCount(1);
            result.DataSources[0].Name.Should().Be("Hello there.txt");
            result.DataSources[0].SizeInBytes.Should().Be(0, "because the log file is empty");
        }
Пример #2
0
        public void TestUpdate2()
        {
            var model = new LogViewMainPanelViewModel(_actionCenter.Object, _dataSources.Object, _quickFilters.Object, _settings.Object);
            var dataSourceViewModel = new Mock <IDataSourceViewModel>();
            var dataSource          = new Mock <IDataSource>();
            var logFile             = new InMemoryLogFile();

            dataSource.Setup(x => x.UnfilteredLogFile).Returns(logFile);
            var filteredLogFile = new InMemoryLogFile();

            dataSource.Setup(x => x.FilteredLogFile).Returns(filteredLogFile);
            dataSourceViewModel.Setup(x => x.DataSource).Returns(dataSource.Object);
            model.CurrentDataSource = dataSourceViewModel.Object;

            logFile.AddEntry("", LevelFlags.All);
            logFile.SetValue(LogFileProperties.Size, Size.OneByte);
            model.Update();
            model.CurrentDataSourceLogView.NoEntriesExplanation.Should().Be("Not a single log entry matches the level selection");
        }