private void AddPage(IResourceItemEntity instance, string pageName, bool isClosable = true) { var mainWindowTabItem = new MainWindowTabItem(); var itemFrame = new Frame(); itemFrame.Content = SetupPageUserControls(instance); mainWindowTabItem.Content = itemFrame; mainWindowTabItem.Title = pageName; mainWindowTabItem.IsClosable = isClosable; _mainWindowTabControl.AddPage.Invoke(mainWindowTabItem); }
public void WhenMethodIsRegisteredTabSwitchedToAlertsControlEventThenMethodWasInvokedWhenExpected() { MainWindowTabItem selectedTab = MainWindowTabItem.SmartDetectorConfigurationControl; var notificationService = new NotificationService(); notificationService.TabSwitchedToAlertsControl += () => { selectedTab = MainWindowTabItem.AlertsControl; }; notificationService.OnTabSwitchedToAlertsControl(); Assert.AreEqual(MainWindowTabItem.AlertsControl, selectedTab, "Unexpected value of selected tab"); }