public void InstallHyperLinkerNavgiateEvent_Tests()
        {
            int eventFired = 0;
            FrameworkElement testElement = XamlUtilities.GetElementFromString(ValidXamlWithHyperlink);

            testElement.Should().NotBeNull();
            XamlUtilities.InstallHyperLinkerNavgiateEvent(testElement, delegate { eventFired++; });

            var stackPanel = LogicalTreeHelper.GetChildren(testElement).Cast <object>().First() as StackPanel;
            var textBlock  = LogicalTreeHelper.GetChildren(stackPanel).Cast <object>().First() as TextBlock;
            var hyperlink  = LogicalTreeHelper.GetChildren(textBlock).Cast <object>().First() as Hyperlink;

            hyperlink.Should().NotBeNull();

            eventFired.Should().Be(0);
            hyperlink.RaiseEvent(new RequestNavigateEventArgs(hyperlink.NavigateUri, hyperlink.TargetName));
            eventFired.Should().Be(1);
        }
        public void CreateScrollViewElement_Tests()
        {
            SarifViewerPackage.IsUnitTesting = true;

            FrameworkElement testElement = XamlUtilities.GetElementFromString(ValidXamlWithHyperlink);

            testElement.Should().NotBeNull();

            FrameworkElement scrollViewerElement = XamlUtilities.CreateScrollViewElement(testElement);

            scrollViewerElement.Should().NotBeNull();

            ScrollViewer scrollViewer = scrollViewerElement as ScrollViewer;

            scrollViewer.Should().NotBeNull();

            scrollViewer.Content.Should().Be(testElement);
            scrollViewer.VerticalScrollBarVisibility.Should().Be(ScrollBarVisibility.Auto);
            scrollViewer.MaxHeight.Should().Be(XamlUtilities.ScrollViewerMaxHeight);
        }
        public void GetElementFromString_Tests()
        {
            XamlUtilities.GetElementFromString(null).Should().BeNull();
            XamlUtilities.GetElementFromString(string.Empty).Should().BeNull();
            XamlUtilities.GetElementFromString("          ").Should().BeNull();
            XamlUtilities.GetElementFromString("The quick brown fox jumps over the lazy dog").Should().BeNull();
            XamlUtilities.GetElementFromString("<The quick brown> <fox> <jumps over the lazy dog>").Should().BeNull();
            XamlUtilities.GetElementFromString(InvalidXaml).Should().BeNull();

            FrameworkElement testElement = XamlUtilities.GetElementFromString(ValidXamlWithHyperlink);

            testElement.Should().NotBeNull();

            var stackPanel = LogicalTreeHelper.GetChildren(testElement).Cast <object>().First() as StackPanel;

            stackPanel.Should().NotBeNull();
            var textBlock = LogicalTreeHelper.GetChildren(stackPanel).Cast <object>().First() as TextBlock;

            textBlock.Should().NotBeNull();
            var hyperlink = LogicalTreeHelper.GetChildren(textBlock).Cast <object>().First() as Hyperlink;

            hyperlink.Should().NotBeNull();
        }