public void CanGetXmlns_WhenSplitOverMultipleLines()
        {
            var tags = new TagList();

            var xaml = "<Page" +
                       Environment.NewLine + " xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"" +
                       Environment.NewLine + " xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" +
                       Environment.NewLine + " xmlns:local" +
                       Environment.NewLine + "=\"using:XamlChangeTest\"" +
                       Environment.NewLine + " xmlns:d=" +
                       Environment.NewLine + "\"http://schemas.microsoft.com/expression/blend/2008\"" +
                       Environment.NewLine + " xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">" +
                       Environment.NewLine + "    <TestElement />" +
                       Environment.NewLine + "</Page>";

            var snapshot = new FakeTextSnapshot(xaml.Length);
            var vsa      = new TestVisualStudioAbstraction();
            var logger   = DefaultTestLogger.Create();

            var analyzer = new XmnlsCounterAnalyzer();

            var processors = new List <(string, XamlElementProcessor)>
            {
                (analyzer.TargetType(), new CustomProcessorWrapper(analyzer, ProjectType.Any, string.Empty, logger, vsa)),
            };

            XamlElementExtractor.Parse("testfile.xaml", snapshot, xaml, processors, tags, null, RapidXamlDocument.GetEveryElementProcessor(ProjectType.Any, null, vsa), logger);

            Assert.AreEqual(5, analyzer.Count);

            foreach (var key in analyzer.Xmlns.Keys)
            {
                Assert.IsFalse(string.IsNullOrEmpty(analyzer.Xmlns[key]), $"No value for key '{key}'");
            }
        }
        public void PassMultipleXmlnsToAnalyzers_SingleQuotes()
        {
            var tags = new TagList();

            var xaml = "<Page" +
                       Environment.NewLine + " xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'" +
                       Environment.NewLine + " xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'" +
                       Environment.NewLine + " xmlns:local='using:XamlChangeTest'" +
                       Environment.NewLine + " xmlns:d='http://schemas.microsoft.com/expression/blend/2008'" +
                       Environment.NewLine + " xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'>" +
                       Environment.NewLine + "    <TestElement />" +
                       Environment.NewLine + "</Page>";

            var snapshot = new FakeTextSnapshot(xaml.Length);
            var vsa      = new TestVisualStudioAbstraction();
            var logger   = DefaultTestLogger.Create();

            var analyzer = new XmnlsCounterAnalyzer();

            var processors = new List <(string, XamlElementProcessor)>
            {
                (analyzer.TargetType(), new CustomProcessorWrapper(analyzer, ProjectType.Any, string.Empty, logger, vsa)),
            };

            XamlElementExtractor.Parse("testfile.xaml", snapshot, xaml, processors, tags, null, RapidXamlDocument.GetEveryElementProcessor(ProjectType.Any, null, vsa), logger);

            Assert.AreEqual(5, analyzer.Count);
            Assert.AreEqual("http://schemas.microsoft.com/winfx/2006/xaml/presentation", analyzer.Xmlns[string.Empty]);
        }
        public void PassNoXmlnsToAnalyzers()
        {
            var tags = new TagList();

            var xaml = "<Page>" +
                       Environment.NewLine + "    <TestElement />" +
                       Environment.NewLine + "</Page>";

            var snapshot = new FakeTextSnapshot(xaml.Length);
            var vsa      = new TestVisualStudioAbstraction();
            var logger   = DefaultTestLogger.Create();

            var analyzer = new XmnlsCounterAnalyzer();

            var processors = new List <(string, XamlElementProcessor)>
            {
                (analyzer.TargetType(), new CustomProcessorWrapper(analyzer, ProjectType.Any, string.Empty, logger, vsa)),
            };

            XamlElementExtractor.Parse("testfile.xaml", snapshot, xaml, processors, tags, null, RapidXamlDocument.GetEveryElementProcessor(ProjectType.Any, null, vsa), logger);

            Assert.AreEqual(0, analyzer.Count);
        }