Esempio n. 1
0
        public void CanParseWithoutErrors(string filePath)
        {
            var result = new RapidXamlDocument();

            var text = File.ReadAllText(filePath);

            if (text.IsValidXml())
            {
                var snapshot = new RapidXamlToolkit.Tests.FakeTextSnapshot();

                XamlElementExtractor.Parse(snapshot, text, RapidXamlDocument.GetAllProcessors(), result.Tags);

                Debug.WriteLine($"Found {result.Tags.Count} taggable issues in '{filePath}'.");

                if (result.Tags.Count > 0)
                {
                    // if (result.Tags.Count > 10)
                    if (result.Tags.OfType <RapidXamlWarningTag>().Any())
                    {
                        Debugger.Break();
                    }

                    this.TestContext.WriteLine($"Found {result.Tags.Count} taggable issues in '{filePath}'.");
                    this.TestContext.AddResultFile(filePath);
                }
            }
            else
            {
                Debug.WriteLine($"Invalid XAML found in '{filePath}'.");

                this.TestContext.WriteLine($"Invalid XAML found in '{filePath}'.");
                this.TestContext.AddResultFile(filePath);
            }
        }
Esempio n. 2
0
        public void Generic()
        {
            var result = new RapidXamlDocument();

            var text = File.ReadAllText(".\\XamlAnalysis\\TestDocs\\Generic.xaml");

            var snapshot = new RapidXamlToolkit.Tests.FakeTextSnapshot();

            XamlElementExtractor.Parse(snapshot, text, RapidXamlDocument.GetAllProcessors(), result.Tags);

            Assert.AreEqual(0, result.Tags.OfType <MissingRowDefinitionTag>().Count());
            Assert.AreEqual(0, result.Tags.OfType <MissingColumnDefinitionTag>().Count());
        }