public void TestAttributeSortingOptionHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributeOrderingRuleGroups = new[]
                {
                    // Class definition group
                    "x:Class",
                    // WPF Namespaces group
                    "xmlns, xmlns:x",
                    // Other namespace
                    "xmlns:*",
                    // Element key group
                    "Key, x:Key, Uid, x:Uid",
                    // Element name group
                    "Name, x:Name, Title",
                    // Attached layout group
                    "Grid.Column, Grid.ColumnSpan, Grid.Row, Grid.RowSpan, Canvas.Right, Canvas.Bottom, Canvas.Left, Canvas.Top",
                    // Core layout group
                    "MinWidth, MinHeight, Width, Height, MaxWidth, MaxHeight, Margin",
                    // Alignment layout group
                    "Panel.ZIndex, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment",
                    // Unmatched
                    "*:*, *",
                    // Miscellaneous/Other attributes group
                    "Offset, Color, TargetName, Property, Value, StartPoint, EndPoint, PageSource, PageIndex",
                    // Blend related group
                    "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
                }
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
 public void TestSingleLineNestedMarkupExtensions()
 {
     FileHandlingIntegrationTests.DoTest(new StylerOptions
     {
         IndentSize = 2
     });
 }
示例#3
0
        public void TestIgnoringNamespacesInAttributeOrderingWithoutNamespace()
        {
            var stylerOptions = new StylerOptions()
            {
                IgnoreDesignTimeReferencePrefix = true,
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestBindingSplitting()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                NoNewLineMarkupExtensions = "x:Bind, Binding"
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestSuppressedDefaultHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                SuppressProcessing = true
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestReorderSetterHandling(ReorderSettersBy reorderSettersBy)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                ReorderSetters = reorderSettersBy,
            };

            this.DoTestCase(stylerOptions, reorderSettersBy);
        }
示例#7
0
 private void DoTestCase <T>(
     StylerOptions stylerOptions,
     T testIdentifier,
     [System.Runtime.CompilerServices.CallerMemberName] string callerMemberName = "")
 {
     FileHandlingIntegrationTests.DoTest(
         stylerOptions,
         Path.Combine("TestFiles", callerMemberName),
         testIdentifier.ToString());
 }
        public void TestThicknessHandling(ThicknessStyle thicknessStyle)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                ThicknessStyle = thicknessStyle
            };

            this.DoTestCase(stylerOptions, thicknessStyle);
        }
        public void TestAttributeIgnoreEncode()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\TestAttributeIgnoreEncode.json"))
            {
                IgnoreEncodeForAttributes = "Selector"
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestClosingElementHandling(int testNumber, bool spaceBeforeClosingSlash)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                SpaceBeforeClosingSlash = spaceBeforeClosingSlash
            };

            this.DoTestCase(stylerOptions, testNumber);
        }
        public void TestDesignReferenceRemoval()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                RemoveDesignTimeReferences = true
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestKeepSelectAttributesOnFirstLine()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                FirstLineAttributes = "x:Name, x:Key"
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestVisualStateManagerLast()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                ReorderVSM = VisualStateManagerRule.Last
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestNestedPropertiesAndChildrenHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                ReorderVSM = VisualStateManagerRule.First
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestAttributeToleranceHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributesTolerance      = 3,
                RootElementLineBreakRule = LineBreakRule.Always,
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestAttributeOrderRuleGroupsOnSeparateLinesHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                PutAttributeOrderRuleGroupsOnSeparateLines = true,
                MaxAttributesPerLine = 3,
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestMarkupWithAttributeNotOnFirstLine()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                KeepFirstAttributeOnSameLine = false,
                AttributesTolerance          = 1
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestNestedCustomMarkupExtensionsWithBindings()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                KeepFirstAttributeOnSameLine = false,
                AttributesTolerance          = 1,
                NoNewLineMarkupExtensions    = "x:Bind, Binding"
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestRootHandling(int testNumber, LineBreakRule lineBreakRule)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributesTolerance  = 3,
                MaxAttributesPerLine = 4,
                PutAttributeOrderRuleGroupsOnSeparateLines = true,
                RootElementLineBreakRule = lineBreakRule,
            };

            this.DoTestCase(stylerOptions, testNumber);
        }
        public void TestMarkupExtensionHandling(bool indentWithTabs, int tabSize)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                FormatMarkupExtension     = true,
                IndentWithTabs            = indentWithTabs,
                IndentSize                = tabSize,
                AttributeIndentationStyle = AttributeIndentationStyle.Mixed,
            };

            this.DoTestCase(stylerOptions, $"{tabSize}_{(indentWithTabs ? "tabs" : "spaces")}");
        }
        public void TestAttributeThresholdHandling()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributesTolerance           = 0,
                MaxAttributeCharactersPerLine = 80,
                MaxAttributesPerLine          = 3,
                PutEndingBracketOnNewLine     = true
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
        public void TestAttributeIndentationHandling(byte attributeIndentation)
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributeIndentation          = attributeIndentation,
                AttributesTolerance           = 0,
                MaxAttributeCharactersPerLine = 80,
                MaxAttributesPerLine          = 3,
                PutEndingBracketOnNewLine     = true
            };

            this.DoTestCase(stylerOptions, attributeIndentation);
        }
示例#23
0
        public void TestAxamlNoEscaping()
        {
            var stylerOptions = this.GetLegacyStylerOptions();

            var stylerService = new StylerService(stylerOptions, new XamlLanguageOptions()
            {
                IsFormatable = true,
                UnescapedAttributeCharacters =
                {
                    '>'
                }
            });

            FileHandlingIntegrationTests.DoTest(stylerService, stylerOptions, Path.Combine("TestFiles", "TestAxamlNoEscaping"), null);
        }
        public void TestWildCard()
        {
            var stylerOptions = new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json"))
            {
                AttributeOrderingRuleGroups = new[]
                {
                    "x:Class*",
                    "xmlns, xmlns:x",
                    "xmlns:*",
                    "Grid.*, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
                    "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
                    "*:*, *",
                    "ToolTipService.*, AutomationProperties.*",
                    "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText"
                }
            };

            FileHandlingIntegrationTests.DoTest(stylerOptions);
        }
示例#25
0
 private void DoTest(
     StylerOptions stylerOptions,
     [System.Runtime.CompilerServices.CallerMemberName] string callerMemberName = "")
 {
     FileHandlingIntegrationTests.DoTest(stylerOptions, Path.Combine("TestFiles", callerMemberName), null);
 }
 public void TestDefaultHandling()
 {
     FileHandlingIntegrationTests.DoTest(this.GetLegacyStylerOptions());
 }
 public void TestCommentAtFirstLine()
 {
     FileHandlingIntegrationTests.DoTest(this.GetLegacyStylerOptions());
 }
 public void TestXmlnsAliasesHandling()
 {
     FileHandlingIntegrationTests.DoTest(this.GetLegacyStylerOptions());
 }
 private StylerOptions GetLegacyStylerOptions()
 {
     return(new StylerOptions(
                config: FileHandlingIntegrationTests.GetConfiguration(@"TestConfigurations\LegacyTestSettings.json")));
 }
 public void TestValueXmlEntityHandling()
 {
     FileHandlingIntegrationTests.DoTest(this.GetLegacyStylerOptions());
 }