Пример #1
0
        public void DontCreateTag_ForNotWin_WhenInIgnorableList()
        {
            var xaml = @"<Page
    x:Class=""App193.MainPage""
    xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
    xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
    xmlns:local=""using:App193""
    xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
    xmlns:mc=""http://schemas.openxmlformats.org/markup-compatibility/2006""
    xmlns:not_win=""http:/uno.ui/not_win""
    mc:Ignorable=""d not_win"">

    <Grid Background=""{ThemeResource ApplicationPageBackgroundThemeBrush}"">
		<TextBlock Text=""Hello, world!"" Margin=""20"" FontSize=""30"" />
    </Grid>
</Page>";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new UnoIgnorablesAnalyzer();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create(ProjectFramework.Uwp));

            Assert.AreEqual(0, actual.Actions.Count);
        }
        public void FindsMultipleIssues_WhenExist()
        {
            var xaml = @"<TwoPaneView>
    <TwoPaneView.Pane1>
        <StackPanel>
            <TwoPaneView />
            <TwoPaneView />
        <StackPanel>
    </TwoPaneView.Pane1>
    <TwoPaneView.Pane2>
        <TwoPaneView />
    </TwoPaneView.Pane2>
</TwoPaneView>";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new TwoPaneViewAnalyzer();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create());

            Assert.AreEqual(3, actual.Actions.Count);
            Assert.AreEqual(ActionType.HighlightWithoutAction, actual.Actions[0].Action);
            Assert.AreEqual(ActionType.HighlightWithoutAction, actual.Actions[1].Action);
            Assert.AreEqual(ActionType.HighlightWithoutAction, actual.Actions[2].Action);
        }
Пример #3
0
        public void DoesNotFindIssue_WhenNoneExists()
        {
            var xaml = "<Foo Bar=\"Enabled\">";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new FooAnalysis();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create());

            Assert.AreEqual(0, actual.Actions.Count);
            Assert.IsTrue(actual.IsNone);
        }
Пример #4
0
        public void FindsIssue_WhenExists()
        {
            var xaml = @"<Foo />";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new FooAnalysis();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create());

            Assert.AreEqual(1, actual.Actions.Count);
            Assert.AreEqual(ActionType.AddAttribute, actual.Actions[0].Action);
        }
        public void FindsIssue_InPane1_WhenExists()
        {
            var xaml = @"<TwoPaneView>
    <TwoPaneView.Pane1>
        <TwoPaneView />
    </TwoPaneView.Pane1>
    <TwoPaneView.Pane2>
        <TextBlock Text=""Hello Other World"" />
    </TwoPaneView.Pane2>
</TwoPaneView>";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new TwoPaneViewAnalyzer();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create());

            Assert.AreEqual(1, actual.Actions.Count);
            Assert.AreEqual(ActionType.HighlightWithoutAction, actual.Actions[0].Action);
        }
        public void DoesNotFindIssue_WhenNoneExists()
        {
            var xaml = @"<TwoPaneView>
    <TwoPaneView.Pane1>
        <TextBlock Text=""Hello World"" />
    </TwoPaneView.Pane1>
    <TwoPaneView.Pane2>
        <TextBlock Text=""Hello rest of the World"" />
    </TwoPaneView.Pane2>
</TwoPaneView>";

            var rxElement = CustomAnalysisTestHelper.StringToElement(xaml);

            var sut = new TwoPaneViewAnalyzer();

            var actual = sut.Analyze(rxElement, FakeExtraAnalysisDetails.Create());

            Assert.AreEqual(0, actual.Actions.Count);
            Assert.IsTrue(actual.IsNone);
        }