public Mocks(ViewModelObjects viewModel) { CredentialsCache = Substitute.For <Preprocessing.ICredentialsCache>(); WebBrowserDownloader = Substitute.For <WebViewTools.IWebViewTools>(); WebContentCacheConfig = Substitute.For <Persistence.IWebContentCacheConfig>(); LogsDownloaderConfig = Substitute.For <Preprocessing.ILogsDownloaderConfig>(); ShellOpen = Substitute.For <LogJoint.UI.Presenters.IShellOpen>(); FileDialogs = Substitute.For <LogJoint.UI.Presenters.IFileDialogs>(); PromptDialog = Substitute.For <LogJoint.UI.Presenters.IPromptDialog>(); AboutConfig = Substitute.For <LogJoint.UI.Presenters.About.IAboutConfig>(); DragDropHandler = Substitute.For <LogJoint.UI.Presenters.MainForm.IDragDropHandler>(); SystemThemeDetector = Substitute.For <LogJoint.UI.Presenters.ISystemThemeDetector>(); Views = Substitute.For <LogJoint.UI.Presenters.Factory.IViewsFactory>(); Views.CreateLoadedMessagesView().Returns(viewModel.LoadedMessagesViewProxy); Views.CreateSourcesManagerView().Returns(viewModel.SourcesManagerViewProxy); Views.CreateSourcesListView().Returns(viewModel.SourcesListViewProxy); Views.CreatePostprocessingTabPage().Returns(viewModel.PostprocessingTabPage); Views.PostprocessingViewsFactory.CreateStateInspectorView().Returns(viewModel.PostprocesssingStateInspectorViewProxy); Views.CreatePreprocessingView().Returns(viewModel.PreprocessingUserInteractions); Views.CreateSearchPanelView().Returns(viewModel.SearchPanel); Views.CreateSearchResultView().Returns(viewModel.SearchResult); Views.CreateBookmarksListView().Returns(viewModel.BookmarksList); Views.CreateHistoryDialogView().Returns(viewModel.HistoryDialog); Views.CreateMessagePropertiesDialogView().Returns(viewModel.MessageProperties); }
public static SI.MenuData.Item CreateStateInspectorMenuItem( SI.IVisualizerNode selectedNode, LogJoint.UI.Presenters.IPromptDialog prompt, Preprocessing.IManager preprocessingManager, SpringServiceLog.IPreprocessingStepsFactory preprocessingStepsFactory ) { if (preprocessingStepsFactory == null) { return(null); } SI.IVisualizerNode GetParent(SI.IVisualizerNode n) => n.Parent == null ? n : GetParent(n.Parent); var(id, referenceTime, env) = Rtc.MeetingsStateInspector.GetMeetingRelatedId( selectedNode.CreationEvent, selectedNode.ChangeHistory, GetParent(selectedNode).CreationEvent, GetParent(selectedNode).ChangeHistory ); if (id == null) { return(null); } return(new SI.MenuData.Item( "Download backend logs", () => { var input = prompt.ExecuteDialog( "Download RTC backend logs", "Specify query parameters", $"ID={id}{Environment.NewLine}Environment={env ?? "(undetected)"}{Environment.NewLine}Reference time={referenceTime.ToString("o")}"); if (input != null) { var ids = new[] { id }; foreach (var line in input.Split('\r', '\n')) { var m = Regex.Match(line, @"^(?<k>[^\=]+)\=(?<v>.+)$", RegexOptions.ExplicitCapture); if (!m.Success) { continue; } var k = m.Groups["k"].Value; var v = m.Groups["v"].Value; if (k == "ID") { ids = v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } else if (k == "Environment") { env = v; } else if (k == "Reference time") { if (DateTime.TryParseExact(v, "o", null, System.Globalization.DateTimeStyles.None, out var tmpRefTime)) { referenceTime = tmpRefTime; } } } preprocessingManager.Preprocess( new[] { preprocessingStepsFactory.CreateDownloadBackendLogsStep(ids, referenceTime, env) }, "Downloading backend logs", Preprocessing.PreprocessingOptions.HighlightNewPreprocessing ); } } )); }