SonarLint.VisualStudio.Integration.UnitTests.ConfigurableSectionController.CreateDefault C# (CSharp) Method

CreateDefault() public static method

public static CreateDefault ( ) : ConfigurableSectionController
return ConfigurableSectionController
        public static ConfigurableSectionController CreateDefault()
        {
            var section = new ConfigurableSectionController();
            section.ViewModel = new ConnectSectionViewModel();
            section.View = new ConnectSectionView();
            section.ProgressHost = new ConfigurableProgressControlHost();
            section.UserNotifications = new ConfigurableUserNotification();
            section.BindCommand = new RelayCommand(() => { });
            section.ConnectCommand = new RelayCommand(() => { });
            section.DisconnectCommand = new RelayCommand(() => { });
            section.RefreshCommand = new RelayCommand(() => { });
            section.BrowseToUrlCommand = new RelayCommand(() => { });
            section.BrowseToProjectDashboardCommand = new RelayCommand(() => { });
            section.ToggleShowAllProjectsCommand = new RelayCommand(() => { });
            return section;
        }
        #endregion

Usage Example

        public void RuleSetConflictsController_FixConflictsCommandExecution()
        {
            // Arrange
            var testSubject = new RuleSetConflictsController(this.host, this.conflictsManager);

            this.ConfigureServiceProviderForFixConflictsCommandExecution();
            this.host.VisualStateManager.IsBusy = false;
            this.host.VisualStateManager.SetBoundProject(new Uri("http://foo"), null, "project123");
            var section = ConfigurableSectionController.CreateDefault();

            this.host.SetActiveSection(section);
            ConfigurableUserNotification notifications = (ConfigurableUserNotification)section.UserNotifications;

            ProjectRuleSetConflict[] conflicts = new[] { ConfigurableConflictsManager.CreateConflict() };

            RuleSet fixedRuleSet = TestRuleSetHelper.CreateTestRuleSet(3);

            fixedRuleSet.FilePath = "MyFixedRules.ruleset";

            RuleSetInspectorTestDataProvider inspectorData = new RuleSetInspectorTestDataProvider();
            var weakenedRulesMap = new Dictionary <RuleReference, RuleAction>();

            inspectorData.FindConflictsResult = new RuleConflictInfo(new RuleReference[0], weakenedRulesMap);
            inspectorData.FixConflictsResult  = new FixedRuleSetInfo(fixedRuleSet, new[] { "reset.ruleset" }, new[] { "deletedRuleId1" });
            this.ruleSetInspector.FindConflictingRulesAction = inspectorData.FindConflictingRulesAction;
            this.ruleSetInspector.FixConflictingRulesAction  = inspectorData.FixConflictingRulesAction;

            ICommand fixMeCommand = testSubject.CreateFixConflictsCommand(conflicts);

            section.UserNotifications.ShowNotificationWarning("fix me", NotificationIds.RuleSetConflictsId, fixMeCommand);

            // Act
            fixMeCommand.Execute(null);

            // Assert
            this.sccFS.files.Should().ContainKey(fixedRuleSet.FilePath);
            this.rsSerializer.AssertRuleSetsAreSame(fixedRuleSet.FilePath, fixedRuleSet);
            this.outputWindowPane.AssertOutputStrings(1);
            this.outputWindowPane.AssertMessageContainsAllWordsCaseSensitive(0,
                                                                             words: new[] { fixedRuleSet.FilePath, "deletedRuleId1", "reset.ruleset" },
                                                                             splitter: new[] { '\n', '\r', '\t', '\'', ':' });
            notifications.AssertNoNotification(NotificationIds.RuleSetConflictsId);
        }
All Usage Examples Of SonarLint.VisualStudio.Integration.UnitTests.ConfigurableSectionController::CreateDefault
ConfigurableSectionController