Beispiel #1
0
        public void WorkbenchIsActivatedViaContextMenu()
        {
            // Act
            var xpathWorkbench = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);

            // Assert
            Assert.That(xpathWorkbench.IsVisible, Is.True);
        }
Beispiel #2
0
        public void WorkbenchRunsQueryEvenThoughNoNodeIsSelected()
        {
            // Act
            var xpathWorkbench = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);

            xpathWorkbench.Search("§ invalid XPath §");

            // Assert
            Assert.That(xpathWorkbench.SearchResultText, Does.Contain(PackageResources.XPathEvaluationErrorText));
        }
Beispiel #3
0
        public void WorkbenchHandlesXmlNamespaces()
        {
            // Arrange
            var xpathWorkbench     = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);
            var expectedResultText = string.Format(PackageResources.SingleResultText, 1);

            // Act
            xpathWorkbench.Search("/urn:assemblyBinding/urn:dependentAssembly");

            // Assert
            Assert.That(xpathWorkbench.SearchResultText, Does.Contain(expectedResultText));
        }
Beispiel #4
0
        public void WorkbenchShowsSearchResultCount()
        {
            // Arrange
            var xpathWorkbench     = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);
            var expectedResultText = string.Format(PackageResources.SingleResultText, 1);

            // Act
            xpathWorkbench.Search("//*[local-name()='assemblyBinding']");

            // Assert
            Assert.That(xpathWorkbench.SearchResultText, Does.Contain(expectedResultText));
        }
Beispiel #5
0
        public void WorkbenchReattachesCorrectDocumentWindow()
        {
            // Arrange - open a document, run a search, close the document
            var xpathWorkbench = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);

            xpathWorkbench.Search("/urn:assemblyBinding/urn:dependentAssembly");
            xpathWorkbench.GetSearchResult(0).LeftClick();
            SendKeys.SendWait("^{F4}"); // Close the document using CTRL + F4

            // Act - click the search result
            xpathWorkbench.GetSearchResult(0).LeftClick();

            // Assert - verify that the document is reopened
            Assert.That(_visualStudio.GetSelectedDocument().GetText(), Is.EqualTo(_defaultXmlFile.Name));
        }
Beispiel #6
0
        public void WorkbenchActivatesCorrectDocumentWindow()
        {
            // Arrange
            var xpathWorkbench = new XPathWorkbenchAutomationModel(_visualStudio.MainWindow);

            xpathWorkbench.Search("/urn:assemblyBinding/urn:dependentAssembly");
            var xml = "<!-- This XML file is not the search result source --><root />";

            _visualStudio.OpenXmlFile(xml, null);

            // Act
            xpathWorkbench.GetSearchResult(0).LeftClick();

            // Assert
            Assert.That(_visualStudio.GetSelectedDocument().GetText(), Is.EqualTo(_defaultXmlFile.Name));
        }