Пример #1
0
        public void TestLogFileAdd1()
        {
            _control.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent));
            _control.LogSource = _logSource;
            DispatcherExtensions.ExecuteAllEvents();

            var entries = new List <IReadOnlyLogEntry>();

            for (int i = 0; i < 1000; ++i)
            {
                entries.Add(new ReadOnlyLogEntry(new Dictionary <IColumnDescriptor, object>
                {
                    { Columns.RawContent, "Foobar" },
                    { Columns.LogLevel, LevelFlags.Info }
                }));
            }
            _logSource.AddRange(entries);

            _control.VisibleTextLines.Count.Should().Be(0, "Because the view may not have synchronized itself with the log file");
            _control.PendingModificationsCount.Should().BeGreaterOrEqualTo(1, "Because this log file modification should have been tracked by the control");

            Thread.Sleep((int)(2 * LogEntryListView.MaximumRefreshInterval.TotalMilliseconds));
            DispatcherExtensions.ExecuteAllEvents();

            _control.VisibleTextLines.Count.Should().Be(52, "Because the view must have synchronized itself and display the maximum of 52 lines");
        }