public void SetUp() { _keyboard = new TestKeyboard(); _mouse = new TestMouse(); _control = new LogEntryListView { Width = 1024, Height = 768 }; var availableSize = new Size(1024, 768); _control.Measure(availableSize); _control.Arrange(new Rect(new Point(), availableSize)); DispatcherExtensions.ExecuteAllEvents(); _logSource = new InMemoryLogSource(Columns.Minimum.Concat(new[] { PageBufferedLogSource.RetrievalState })); _deltaTimesColumn = (DeltaTimeColumnPresenter)typeof(LogEntryListView).GetField("_deltaTimesColumn", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_control); }
public void SetUp() { _keyboard = new TestKeyboard(); _mouse = new TestMouse(); _control = new LogEntryListView { Width = 1024, Height = 768 }; var availableSize = new Size(1024, 768); _control.Measure(availableSize); _control.Arrange(new Rect(new Point(), availableSize)); DispatcherExtensions.ExecuteAllEvents(); _lines = new List <LogLine>(); _listeners = new List <ILogFileListener>(); _logFile = new Mock <ILogFile>(); _logFile.Setup(x => x.Count).Returns(() => _lines.Count); _logFile.Setup(x => x.GetSection(It.IsAny <LogFileSection>(), It.IsAny <LogLine[]>())) .Callback((LogFileSection section, LogLine[] dest) => _lines.CopyTo((int)section.Index, dest, 0, section.Count)); _logFile.Setup(x => x.GetLine(It.IsAny <int>())).Returns((int index) => _lines[index]); _logFile.Setup(x => x.AddListener(It.IsAny <ILogFileListener>(), It.IsAny <TimeSpan>(), It.IsAny <int>())) .Callback((ILogFileListener listener, TimeSpan maximumTimeout, int maximumLines) => { _listeners.Add(listener); listener.OnLogFileModified(_logFile.Object, new LogFileSection(0, _lines.Count)); }); _deltaTimesColumn = (DeltaTimeColumnPresenter)typeof(LogEntryListView).GetField("_deltaTimesColumn", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_control); }