Example #1
0
        public void DisplayText_UsesIssueRuleKey()
        {
            var selectedIssueMock = new Mock <IAnalysisIssueVisualization>();

            selectedIssueMock.Setup(x => x.RuleId).Returns("test rule id");

            var testSubject = new SelectIssueVisualizationAction(Mock.Of <IVsUIShell>(), Mock.Of <IIssueSelectionService>(), selectedIssueMock.Object);

            testSubject.DisplayText.Should().Contain("test rule id");
        }
Example #2
0
        public void Invoke_IssueIsSelected()
        {
            var selectionServiceMock = new Mock <IIssueSelectionService>();

            selectionServiceMock.SetupSet(x => x.SelectedIssue = null);

            var expectedIssue = Mock.Of <IAnalysisIssueVisualization>();
            var testSubject   = new SelectIssueVisualizationAction(Mock.Of <IVsUIShell>(), selectionServiceMock.Object, expectedIssue);

            selectionServiceMock.VerifySet(x => x.SelectedIssue = It.IsAny <IAnalysisIssueVisualization>(), Times.Never());

            testSubject.Invoke(CancellationToken.None);

            selectionServiceMock.VerifySet(x => x.SelectedIssue = expectedIssue, Times.Once());
        }
Example #3
0
        public void Invoke_IssueVisualizationToolWindowOpened()
        {
            var vsUiShell   = new Mock <IVsUIShell>();
            var testSubject = new SelectIssueVisualizationAction(vsUiShell.Object, Mock.Of <IIssueSelectionService>(), Mock.Of <IAnalysisIssueVisualization>());

            vsUiShell.VerifyNoOtherCalls();

            testSubject.Invoke(CancellationToken.None);

            object inputArgs = 0;
            var    guid      = IssueVisualizationToolWindowCommand.CommandSet;

            vsUiShell.Verify(x => x.PostExecCommand(
                                 ref guid,
                                 IssueVisualizationToolWindowCommand.ViewToolWindowCommandId,
                                 0,
                                 ref inputArgs),
                             Times.Once);
        }