From 04f8720739b9331581794eeb55a7a8d0e11258bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 13 Apr 2012 11:05:51 +0200 Subject: [PATCH] Added formatting factory - formatting options should be created with that. --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 4 +- .../Completion/CSharpCompletionEngine.cs | 2 +- .../Formatter/CSharpFormattingOptions.cs | 117 +----- .../Formatter/FormattingOptionsFactory.cs | 339 ++++++++++++++++++ .../ICSharpCode.NRefactory.CSharp.csproj | 1 + .../OutputVisitor/CSharpAmbience.cs | 4 +- .../OutputVisitor/CodeDomConvertVisitor.cs | 4 +- .../RoundtripTest.cs | 4 +- .../CSharp/CSharpOutputVisitorTests.cs | 4 +- .../CodeActions/TestRefactoringContext.cs | 6 +- .../CodeCompletion/CodeCompletionBugTests.cs | 6 +- .../CSharp/InsertParenthesesVisitorTests.cs | 2 +- .../TestBlankLineFormatting.cs | 16 +- .../FormattingTests/TestBraceStlye.cs | 36 +- .../FormattingTests/TestFormattingBugs.cs | 18 +- .../TestKeepReformattingRules.cs | 6 +- .../FormattingTests/TestSpacingVisitor.cs | 172 ++++----- .../TestStatementIndentation.cs | 144 ++++---- .../TestTypeLevelIndentation.cs | 42 +-- .../FormattingTests/TestWrapping.cs | 6 +- .../Ast/Statements/Statement.cs | 2 +- 21 files changed, 581 insertions(+), 354 deletions(-) create mode 100644 ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 4abbac2f1a..bc4d27de03 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -1,4 +1,4 @@ -// +// // AstNode.cs // // Author: @@ -831,7 +831,7 @@ namespace ICSharpCode.NRefactory.CSharp if (IsNull) return ""; var w = new StringWriter (); - AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? new CSharpFormattingOptions ())); + AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? FormattingOptionsFactory.CreateMono ())); return w.ToString (); } diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs index f76cd39e3c..e388e40937 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs @@ -68,7 +68,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion this.document = document; this.factory = factory; // Set defaults for additional input properties - this.FormattingPolicy = new CSharpFormattingOptions (); + this.FormattingPolicy = FormattingOptionsFactory.CreateMono (); this.EolMarker = Environment.NewLine; this.IndentString = "\t"; } diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs b/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs index 0ed4619d20..0cf8d42a0e 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs @@ -788,121 +788,8 @@ namespace ICSharpCode.NRefactory.CSharp #endregion - public CSharpFormattingOptions() + internal CSharpFormattingOptions() { - IndentNamespaceBody = true; - IndentClassBody = IndentInterfaceBody = IndentStructBody = IndentEnumBody = true; - IndentMethodBody = IndentPropertyBody = IndentEventBody = true; - IndentBlocks = true; - IndentSwitchBody = false; - IndentCaseBody = true; - IndentBreakStatements = true; - NamespaceBraceStyle = BraceStyle.NextLine; - ClassBraceStyle = InterfaceBraceStyle = StructBraceStyle = EnumBraceStyle = BraceStyle.NextLine; - MethodBraceStyle = ConstructorBraceStyle = DestructorBraceStyle = BraceStyle.NextLine; - AnonymousMethodBraceStyle = BraceStyle.EndOfLine; - - PropertyBraceStyle = PropertyGetBraceStyle = PropertySetBraceStyle = BraceStyle.EndOfLine; - AllowPropertyGetBlockInline = AllowPropertySetBlockInline = true; - - EventBraceStyle = EventAddBraceStyle = EventRemoveBraceStyle = BraceStyle.EndOfLine; - AllowEventAddBlockInline = AllowEventRemoveBlockInline = true; - StatementBraceStyle = BraceStyle.EndOfLine; - - PlaceElseOnNewLine = false; - PlaceCatchOnNewLine = false; - PlaceFinallyOnNewLine = false; - PlaceWhileOnNewLine = false; - ArrayInitializerWrapping = Wrapping.WrapIfTooLong; - ArrayInitializerBraceStyle = BraceStyle.EndOfLine; - - SpaceBeforeMethodCallParentheses = true; - SpaceBeforeMethodDeclarationParentheses = true; - SpaceBeforeConstructorDeclarationParentheses = true; - SpaceBeforeDelegateDeclarationParentheses = true; - SpaceAfterMethodCallParameterComma = true; - SpaceAfterConstructorDeclarationParameterComma = true; - - SpaceBeforeNewParentheses = true; - SpacesWithinNewParentheses = false; - SpacesBetweenEmptyNewParentheses = false; - SpaceBeforeNewParameterComma = false; - SpaceAfterNewParameterComma = true; - - SpaceBeforeIfParentheses = true; - SpaceBeforeWhileParentheses = true; - SpaceBeforeForParentheses = true; - SpaceBeforeForeachParentheses = true; - SpaceBeforeCatchParentheses = true; - SpaceBeforeSwitchParentheses = true; - SpaceBeforeLockParentheses = true; - SpaceBeforeUsingParentheses = true; - SpaceAroundAssignment = true; - SpaceAroundLogicalOperator = true; - SpaceAroundEqualityOperator = true; - SpaceAroundRelationalOperator = true; - SpaceAroundBitwiseOperator = true; - SpaceAroundAdditiveOperator = true; - SpaceAroundMultiplicativeOperator = true; - SpaceAroundShiftOperator = true; - SpaceAroundNullCoalescingOperator = true; - SpacesWithinParentheses = false; - SpaceWithinMethodCallParentheses = false; - SpaceWithinMethodDeclarationParentheses = false; - SpacesWithinIfParentheses = false; - SpacesWithinWhileParentheses = false; - SpacesWithinForParentheses = false; - SpacesWithinForeachParentheses = false; - SpacesWithinCatchParentheses = false; - SpacesWithinSwitchParentheses = false; - SpacesWithinLockParentheses = false; - SpacesWithinUsingParentheses = false; - SpacesWithinCastParentheses = false; - SpacesWithinSizeOfParentheses = false; - SpacesWithinTypeOfParentheses = false; - SpacesWithinCheckedExpressionParantheses = false; - SpaceBeforeConditionalOperatorCondition = true; - SpaceAfterConditionalOperatorCondition = true; - SpaceBeforeConditionalOperatorSeparator = true; - SpaceAfterConditionalOperatorSeparator = true; - - SpacesWithinBrackets = false; - SpacesBeforeBrackets = true; - SpaceBeforeBracketComma = false; - SpaceAfterBracketComma = true; - - SpaceBeforeForSemicolon = false; - SpaceAfterForSemicolon = true; - SpaceAfterTypecast = false; - - AlignEmbeddedIfStatements = true; - AlignEmbeddedUsingStatements = true; - PropertyFormatting = PropertyFormatting.AllowOneLine; - SpaceBeforeMethodDeclarationParameterComma = false; - SpaceAfterMethodDeclarationParameterComma = true; - SpaceBeforeFieldDeclarationComma = false; - SpaceAfterFieldDeclarationComma = true; - SpaceBeforeLocalVariableDeclarationComma = false; - SpaceAfterLocalVariableDeclarationComma = true; - - SpaceBeforeIndexerDeclarationBracket = true; - SpaceWithinIndexerDeclarationBracket = false; - SpaceBeforeIndexerDeclarationParameterComma = false; - SpaceInNamedArgumentAfterDoubleColon = true; - - SpaceAfterIndexerDeclarationParameterComma = true; - - BlankLinesBeforeUsings = 0; - BlankLinesAfterUsings = 1; - - - BlankLinesBeforeFirstDeclaration = 0; - BlankLinesBetweenTypes = 1; - BlankLinesBetweenFields = 0; - BlankLinesBetweenEventFields = 0; - BlankLinesBetweenMembers = 1; - - KeepCommentsAtFirstColumn = true; } /*public static CSharpFormattingOptions Load (FilePath selectedFile) @@ -914,7 +801,7 @@ namespace ICSharpCode.NRefactory.CSharp public static CSharpFormattingOptions Load (System.IO.Stream input) { - CSharpFormattingOptions result = new CSharpFormattingOptions (); + CSharpFormattingOptions result = FormattingOptionsFactory.CreateMonoOptions (); result.Name = "noname"; using (XmlTextReader reader = new XmlTextReader (input)) { while (reader.Read ()) { diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs new file mode 100644 index 0000000000..331a1579cc --- /dev/null +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs @@ -0,0 +1,339 @@ +// +// FormattingOptionsFactory.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; + +namespace ICSharpCode.NRefactory.CSharp +{ + /// + /// The formatting options factory creates pre defined formatting option styles. + /// + public static class FormattingOptionsFactory + { + /// + /// Creates empty CSharpFormatting options. + /// + public static CSharpFormattingOptions CreateEmpty() + { + return new CSharpFormattingOptions(); + } + + /// + /// Creates mono indent style CSharpFormatting options. + /// + public static CSharpFormattingOptions CreateMono() + { + return new CSharpFormattingOptions() { + IndentNamespaceBody = true, + IndentClassBody = true, + IndentInterfaceBody = true, + IndentStructBody = true, + IndentEnumBody = true, + IndentMethodBody = true, + IndentPropertyBody = true, + IndentEventBody = true, + IndentBlocks = true, + IndentSwitchBody = false, + IndentCaseBody = true, + IndentBreakStatements = true, + NamespaceBraceStyle = BraceStyle.NextLine, + ClassBraceStyle = BraceStyle.NextLine, + InterfaceBraceStyle = BraceStyle.NextLine, + StructBraceStyle = BraceStyle.NextLine, + EnumBraceStyle = BraceStyle.NextLine, + MethodBraceStyle = BraceStyle.NextLine, + ConstructorBraceStyle = BraceStyle.NextLine, + DestructorBraceStyle = BraceStyle.NextLine, + AnonymousMethodBraceStyle = BraceStyle.EndOfLine, + + PropertyBraceStyle = BraceStyle.EndOfLine, + PropertyGetBraceStyle = BraceStyle.EndOfLine, + PropertySetBraceStyle = BraceStyle.EndOfLine, + AllowPropertyGetBlockInline = true, + AllowPropertySetBlockInline = true, + + EventBraceStyle = BraceStyle.EndOfLine, + EventAddBraceStyle = BraceStyle.EndOfLine, + EventRemoveBraceStyle = BraceStyle.EndOfLine, + AllowEventAddBlockInline = true, + AllowEventRemoveBlockInline = true, + StatementBraceStyle = BraceStyle.EndOfLine, + + PlaceElseOnNewLine = false, + PlaceCatchOnNewLine = false, + PlaceFinallyOnNewLine = false, + PlaceWhileOnNewLine = false, + ArrayInitializerWrapping = Wrapping.WrapIfTooLong, + ArrayInitializerBraceStyle = BraceStyle.EndOfLine, + + SpaceBeforeMethodCallParentheses = true, + SpaceBeforeMethodDeclarationParentheses = true, + SpaceBeforeConstructorDeclarationParentheses = true, + SpaceBeforeDelegateDeclarationParentheses = true, + SpaceAfterMethodCallParameterComma = true, + SpaceAfterConstructorDeclarationParameterComma = true, + + SpaceBeforeNewParentheses = true, + SpacesWithinNewParentheses = false, + SpacesBetweenEmptyNewParentheses = false, + SpaceBeforeNewParameterComma = false, + SpaceAfterNewParameterComma = true, + + SpaceBeforeIfParentheses = true, + SpaceBeforeWhileParentheses = true, + SpaceBeforeForParentheses = true, + SpaceBeforeForeachParentheses = true, + SpaceBeforeCatchParentheses = true, + SpaceBeforeSwitchParentheses = true, + SpaceBeforeLockParentheses = true, + SpaceBeforeUsingParentheses = true, + SpaceAroundAssignment = true, + SpaceAroundLogicalOperator = true, + SpaceAroundEqualityOperator = true, + SpaceAroundRelationalOperator = true, + SpaceAroundBitwiseOperator = true, + SpaceAroundAdditiveOperator = true, + SpaceAroundMultiplicativeOperator = true, + SpaceAroundShiftOperator = true, + SpaceAroundNullCoalescingOperator = true, + SpacesWithinParentheses = false, + SpaceWithinMethodCallParentheses = false, + SpaceWithinMethodDeclarationParentheses = false, + SpacesWithinIfParentheses = false, + SpacesWithinWhileParentheses = false, + SpacesWithinForParentheses = false, + SpacesWithinForeachParentheses = false, + SpacesWithinCatchParentheses = false, + SpacesWithinSwitchParentheses = false, + SpacesWithinLockParentheses = false, + SpacesWithinUsingParentheses = false, + SpacesWithinCastParentheses = false, + SpacesWithinSizeOfParentheses = false, + SpacesWithinTypeOfParentheses = false, + SpacesWithinCheckedExpressionParantheses = false, + SpaceBeforeConditionalOperatorCondition = true, + SpaceAfterConditionalOperatorCondition = true, + SpaceBeforeConditionalOperatorSeparator = true, + SpaceAfterConditionalOperatorSeparator = true, + + SpacesWithinBrackets = false, + SpacesBeforeBrackets = true, + SpaceBeforeBracketComma = false, + SpaceAfterBracketComma = true, + + SpaceBeforeForSemicolon = false, + SpaceAfterForSemicolon = true, + SpaceAfterTypecast = false, + + AlignEmbeddedIfStatements = true, + AlignEmbeddedUsingStatements = true, + PropertyFormatting = PropertyFormatting.AllowOneLine, + SpaceBeforeMethodDeclarationParameterComma = false, + SpaceAfterMethodDeclarationParameterComma = true, + SpaceBeforeFieldDeclarationComma = false, + SpaceAfterFieldDeclarationComma = true, + SpaceBeforeLocalVariableDeclarationComma = false, + SpaceAfterLocalVariableDeclarationComma = true, + + SpaceBeforeIndexerDeclarationBracket = true, + SpaceWithinIndexerDeclarationBracket = false, + SpaceBeforeIndexerDeclarationParameterComma = false, + SpaceInNamedArgumentAfterDoubleColon = true, + + SpaceAfterIndexerDeclarationParameterComma = true, + + BlankLinesBeforeUsings = 0, + BlankLinesAfterUsings = 1, + + + BlankLinesBeforeFirstDeclaration = 0, + BlankLinesBetweenTypes = 1, + BlankLinesBetweenFields = 0, + BlankLinesBetweenEventFields = 0, + BlankLinesBetweenMembers = 1, + + KeepCommentsAtFirstColumn = true, + }; + } + + /// + /// Creates sharp develop indent style CSharpFormatting options. + /// + public static CSharpFormattingOptions CreateSharpDevelop() + { + return new CSharpFormattingOptions() { + IndentNamespaceBody = true, + IndentClassBody = true, + IndentInterfaceBody = true, + IndentStructBody = true, + IndentEnumBody = true, + IndentMethodBody = true, + IndentPropertyBody = true, + IndentEventBody = true, + IndentBlocks = true, + IndentSwitchBody = true, + IndentCaseBody = true, + IndentBreakStatements = true, + + NamespaceBraceStyle = BraceStyle.NextLine, + ClassBraceStyle = BraceStyle.NextLine, + InterfaceBraceStyle = BraceStyle.NextLine, + StructBraceStyle = BraceStyle.NextLine, + EnumBraceStyle = BraceStyle.NextLine, + MethodBraceStyle = BraceStyle.NextLine, + ConstructorBraceStyle = BraceStyle.NextLine, + DestructorBraceStyle = BraceStyle.NextLine, + AnonymousMethodBraceStyle = BraceStyle.EndOfLine, + PropertyBraceStyle = BraceStyle.EndOfLine, + PropertyGetBraceStyle = BraceStyle.EndOfLine, + PropertySetBraceStyle = BraceStyle.EndOfLine, + AllowPropertyGetBlockInline = true, + AllowPropertySetBlockInline = true, + + EventBraceStyle = BraceStyle.EndOfLine, + EventAddBraceStyle = BraceStyle.EndOfLine, + EventRemoveBraceStyle = BraceStyle.EndOfLine, + AllowEventAddBlockInline = true, + AllowEventRemoveBlockInline = true, + StatementBraceStyle = BraceStyle.EndOfLine, + + PlaceElseOnNewLine = false, + PlaceCatchOnNewLine = false, + PlaceFinallyOnNewLine = false, + PlaceWhileOnNewLine = false, + ArrayInitializerWrapping = Wrapping.WrapIfTooLong, + ArrayInitializerBraceStyle = BraceStyle.EndOfLine, + + SpaceBeforeMethodCallParentheses = false, + SpaceBeforeMethodDeclarationParentheses = false, + SpaceBeforeConstructorDeclarationParentheses = false, + SpaceBeforeDelegateDeclarationParentheses = false, + SpaceAfterMethodCallParameterComma = true, + SpaceAfterConstructorDeclarationParameterComma = true, + + SpaceBeforeNewParentheses = false, + SpacesWithinNewParentheses = false, + SpacesBetweenEmptyNewParentheses = false, + SpaceBeforeNewParameterComma = false, + SpaceAfterNewParameterComma = true, + + SpaceBeforeIfParentheses = true, + SpaceBeforeWhileParentheses = true, + SpaceBeforeForParentheses = true, + SpaceBeforeForeachParentheses = true, + SpaceBeforeCatchParentheses = true, + SpaceBeforeSwitchParentheses = true, + SpaceBeforeLockParentheses = true, + SpaceBeforeUsingParentheses = true, + + SpaceAroundAssignment = true, + SpaceAroundLogicalOperator = true, + SpaceAroundEqualityOperator = true, + SpaceAroundRelationalOperator = true, + SpaceAroundBitwiseOperator = true, + SpaceAroundAdditiveOperator = true, + SpaceAroundMultiplicativeOperator = true, + SpaceAroundShiftOperator = true, + SpaceAroundNullCoalescingOperator = true, + SpacesWithinParentheses = false, + SpaceWithinMethodCallParentheses = false, + SpaceWithinMethodDeclarationParentheses = false, + SpacesWithinIfParentheses = false, + SpacesWithinWhileParentheses = false, + SpacesWithinForParentheses = false, + SpacesWithinForeachParentheses = false, + SpacesWithinCatchParentheses = false, + SpacesWithinSwitchParentheses = false, + SpacesWithinLockParentheses = false, + SpacesWithinUsingParentheses = false, + SpacesWithinCastParentheses = false, + SpacesWithinSizeOfParentheses = false, + SpacesWithinTypeOfParentheses = false, + SpacesWithinCheckedExpressionParantheses = false, + SpaceBeforeConditionalOperatorCondition = true, + SpaceAfterConditionalOperatorCondition = true, + SpaceBeforeConditionalOperatorSeparator = true, + SpaceAfterConditionalOperatorSeparator = true, + + SpacesWithinBrackets = false, + SpacesBeforeBrackets = true, + SpaceBeforeBracketComma = false, + SpaceAfterBracketComma = true, + + SpaceBeforeForSemicolon = false, + SpaceAfterForSemicolon = true, + SpaceAfterTypecast = false, + + AlignEmbeddedIfStatements = true, + AlignEmbeddedUsingStatements = true, + PropertyFormatting = PropertyFormatting.AllowOneLine, + SpaceBeforeMethodDeclarationParameterComma = false, + SpaceAfterMethodDeclarationParameterComma = true, + SpaceBeforeFieldDeclarationComma = false, + SpaceAfterFieldDeclarationComma = true, + SpaceBeforeLocalVariableDeclarationComma = false, + SpaceAfterLocalVariableDeclarationComma = true, + + SpaceBeforeIndexerDeclarationBracket = true, + SpaceWithinIndexerDeclarationBracket = false, + SpaceBeforeIndexerDeclarationParameterComma = false, + SpaceInNamedArgumentAfterDoubleColon = true, + + SpaceAfterIndexerDeclarationParameterComma = true, + + BlankLinesBeforeUsings = 0, + BlankLinesAfterUsings = 1, + + BlankLinesBeforeFirstDeclaration = 0, + BlankLinesBetweenTypes = 1, + BlankLinesBetweenFields = 0, + BlankLinesBetweenEventFields = 0, + BlankLinesBetweenMembers = 1, + + KeepCommentsAtFirstColumn = true, + }; + } + + /// + /// Creates allman indent style CSharpFormatting options used in Visual Studio. + /// + public static CSharpFormattingOptions CreateAllman() + { + var baseOptions = CreateSharpDevelop(); + baseOptions.AnonymousMethodBraceStyle = BraceStyle.EndOfLine; + baseOptions.PropertyBraceStyle = BraceStyle.EndOfLine; + baseOptions.PropertyGetBraceStyle = BraceStyle.EndOfLine; + baseOptions.PropertySetBraceStyle = BraceStyle.EndOfLine; + + baseOptions.EventBraceStyle = BraceStyle.EndOfLine; + baseOptions.EventAddBraceStyle = BraceStyle.EndOfLine; + baseOptions.EventRemoveBraceStyle = BraceStyle.EndOfLine; + baseOptions.StatementBraceStyle = BraceStyle.EndOfLine; + baseOptions.ArrayInitializerBraceStyle = BraceStyle.EndOfLine; + return baseOptions; + } + } +} + diff --git a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj index 3ade6f2e44..f9a682ac04 100644 --- a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj +++ b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -368,6 +368,7 @@ + diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs index feaf0711ba..c370e58e4c 100644 --- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs @@ -1,4 +1,4 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software @@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.CSharp throw new ArgumentNullException("entity"); StringWriter writer = new StringWriter(); - ConvertEntity(entity, new TextWriterOutputFormatter(writer), new CSharpFormattingOptions()); + ConvertEntity(entity, new TextWriterOutputFormatter(writer), FormattingOptionsFactory.CreateMono ()); return writer.ToString(); } diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs index c79d87e5c3..6b55c1490e 100644 --- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs @@ -1,4 +1,4 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software @@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp string MakeSnippet(AstNode node) { StringWriter w = new StringWriter(); - CSharpOutputVisitor v = new CSharpOutputVisitor(w, new CSharpFormattingOptions()); + CSharpOutputVisitor v = new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ()); node.AcceptVisitor(v); return w.ToString(); } diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs b/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs index 3a7c6e305e..5fb237f6e0 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs +++ b/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software @@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck // 2. Output StringWriter w = new StringWriter(); - cu.AcceptVisitor(new CSharpOutputVisitor(w, new CSharpFormattingOptions())); + cu.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ())); string generatedCode = w.ToString().TrimEnd(); // 3. Compare output with original (modulo whitespaces) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs index bdb2b089e0..90b4e16887 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software @@ -28,7 +28,7 @@ namespace ICSharpCode.NRefactory.CSharp void AssertOutput(string expected, AstNode node, CSharpFormattingOptions policy = null) { if (policy == null) - policy = new CSharpFormattingOptions(); + policy = FormattingOptionsFactory.CreateMono(); StringWriter w = new StringWriter(); w.NewLine = "\n"; node.AcceptVisitor(new CSharpOutputVisitor(new TextWriterOutputFormatter(w) { IndentationString = "$" }, policy)); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs index dbad04ff66..5e6751150a 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs @@ -1,4 +1,4 @@ -// +// // TestRefactoringContext.cs // // Author: @@ -84,7 +84,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions sealed class TestScript : DocumentScript { readonly TestRefactoringContext context; - public TestScript(TestRefactoringContext context) : base(context.doc, new CSharpFormattingOptions(), new TextEditorOptions ()) + public TestScript(TestRefactoringContext context) : base(context.doc, FormattingOptionsFactory.CreateMono (), new TextEditorOptions ()) { this.context = context; } @@ -265,7 +265,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions internal static void Print (AstNode node) { - var v = new CSharpOutputVisitor (Console.Out, new CSharpFormattingOptions ()); + var v = new CSharpOutputVisitor (Console.Out, FormattingOptionsFactory.CreateMono ()); node.AcceptVisitor (v); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs index 3ac6acd9da..e0016c6924 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs @@ -1,4 +1,4 @@ -// +// // CodeCompletionBugTests.cs // // Author: @@ -241,7 +241,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, rctx, compilationUnit, parsedFile); engine.EolMarker = Environment.NewLine; - engine.FormattingPolicy = new CSharpFormattingOptions (); + engine.FormattingPolicy = FormattingOptionsFactory.CreateMono (); var data = engine.GetCompletionData (cursorPosition, isCtrlSpace); @@ -265,7 +265,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, new CSharpTypeResolveContext (cmp.MainAssembly), compilationUnit, parsedFile); engine.EolMarker = Environment.NewLine; - engine.FormattingPolicy = new CSharpFormattingOptions (); + engine.FormattingPolicy = FormattingOptionsFactory.CreateMono (); return Tuple.Create (doc, engine); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs index 3f2d35e184..ff86cd7b5a 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.CSharp [SetUp] public void SetUp() { - policy = new CSharpFormattingOptions(); + policy = FormattingOptionsFactory.CreateMono (); } string InsertReadable(Expression expr) diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs index f1b7b00258..5a1db9b33d 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs @@ -1,4 +1,4 @@ -// +// // TastBlankLineFormatting.cs // // Author: @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBlankLinesAfterUsings () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesAfterUsings = 2; var adapter = Test (policy, @"using System; @@ -65,7 +65,7 @@ namespace Test [Test()] public void TestBlankLinesBeforeUsings () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesAfterUsings = 0; policy.BlankLinesBeforeUsings = 2; @@ -94,7 +94,7 @@ namespace Test [Test()] public void TestBlankLinesBeforeFirstDeclaration () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesBeforeFirstDeclaration = 2; var adapter = Test (policy, @"namespace Test @@ -125,7 +125,7 @@ namespace Test [Test()] public void TestBlankLinesBetweenTypes () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesBetweenTypes = 1; var adapter = Test (policy, @"namespace Test @@ -173,7 +173,7 @@ namespace Test [Test()] public void TestBlankLinesBetweenFields () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesBetweenFields = 1; var adapter = Test (policy, @"class Test @@ -203,7 +203,7 @@ namespace Test [Test()] public void TestBlankLinesBetweenEventFields () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesBetweenEventFields = 1; var adapter = Test (policy, @"class Test @@ -234,7 +234,7 @@ namespace Test [Test()] public void TestBlankLinesBetweenMembers () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.BlankLinesBetweenMembers = 1; var adapter = Test (policy, @"class Test diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs index 693aaff5ba..69c32c0287 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestNamespaceBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.DoNotChange; @@ -68,7 +68,7 @@ namespace B { [Test()] public void TestAnonymousMethodBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.AnonymousMethodBraceStyle = BraceStyle.EndOfLine; Test (policy, @@ -91,7 +91,7 @@ namespace B { [Test()] public void TestClassBraceStlye () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @@ -103,7 +103,7 @@ namespace B { [Test()] public void TestStructBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StructBraceStyle = BraceStyle.NextLine; Test (policy, @@ -116,7 +116,7 @@ namespace B { [Test()] public void TestInterfaceBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.InterfaceBraceStyle = BraceStyle.NextLine; Test (policy, @@ -129,7 +129,7 @@ namespace B { [Test()] public void TestEnumBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.EnumBraceStyle = BraceStyle.NextLineShifted; Test (policy, @"enum Test { @@ -144,7 +144,7 @@ namespace B { [Test()] public void TestMethodBraceStlye () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.MethodBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -162,7 +162,7 @@ namespace B { [Test()] public void TestConstructorBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ConstructorBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -180,7 +180,7 @@ namespace B { [Test()] public void TestDestructorBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.DestructorBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -198,7 +198,7 @@ namespace B { [Test()] public void TestPropertyBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -221,7 +221,7 @@ namespace B { [Test()] public void TestPropertyGetBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyGetBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -249,7 +249,7 @@ namespace B { public void TestAllowPropertyGetBlockInline () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyBraceStyle = BraceStyle.DoNotChange; policy.AllowPropertyGetBlockInline = true; policy.AllowPropertySetBlockInline = false; @@ -289,7 +289,7 @@ namespace B { [Test()] public void TestAllowPropertySetBlockInline () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyBraceStyle = BraceStyle.DoNotChange; policy.AllowPropertyGetBlockInline = false; policy.AllowPropertySetBlockInline = true; @@ -329,7 +329,7 @@ namespace B { [Test()] public void TestPropertySetBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertySetBraceStyle = BraceStyle.NextLine; Test (policy, @"class Test @@ -356,7 +356,7 @@ namespace B { [Test()] public void TestEventBraceStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.EventBraceStyle = BraceStyle.NextLine; policy.EventAddBraceStyle = BraceStyle.NextLine; policy.EventRemoveBraceStyle = BraceStyle.NextLine; @@ -387,7 +387,7 @@ namespace B { [Test()] public void TestAllowEventAddBlockInline () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.AllowEventAddBlockInline = true; policy.AllowEventRemoveBlockInline = false; @@ -412,7 +412,7 @@ namespace B { [Test()] public void TestAllowEventRemoveBlockInline () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.AllowEventAddBlockInline = false; policy.AllowEventRemoveBlockInline = true; @@ -437,7 +437,7 @@ namespace B { [Test()] public void TestTryCatchWithBannerStyle () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.BannerStyle; Test (policy, @"class Test { diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs index dc1087fdb5..178ad1a3c5 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs @@ -1,4 +1,4 @@ -// +// // TestFormattingBugs.cs // // Author: @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBug325187 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceElseOnNewLine = true; TestStatementFormatting (policy, @@ -62,7 +62,7 @@ Console.WriteLine (""Bad indent"");", [Test()] public void TestBug415469 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); TestStatementFormatting (policy, @"switch (condition) { @@ -86,7 +86,7 @@ case CONDITION2: [Test()] public void TestBug540043 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); TestStatementFormatting (policy, @"using (IDisposable a = null) @@ -105,7 +105,7 @@ using (IDisposable b = null) { [Test()] public void TestBug655635 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); TestStatementFormatting (policy, @"try { @@ -145,7 +145,7 @@ using (IDisposable b = null) { [Test()] public void TestBug659675 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); TestStatementFormatting (policy, "@string=@int;", "@string = @int;"); } @@ -155,7 +155,7 @@ using (IDisposable b = null) { [Test()] public void TestBug670213 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.MethodBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test @@ -178,7 +178,7 @@ using (IDisposable b = null) { [Test()] public void TestBug677261 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ConstructorBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test @@ -200,7 +200,7 @@ using (IDisposable b = null) { [Test()] public void TestBug3586 () { - var policy = new CSharpFormattingOptions (); + var policy = FormattingOptionsFactory.CreateMono (); policy.ConstructorBraceStyle = BraceStyle.EndOfLine; Test (policy, @"public class A diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs index 7ff7c897f0..c0a47e3e7c 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestKeepCommentsAtFirstColumnTrue () { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { KeepCommentsAtFirstColumn = true }; @@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestKeepCommentsAtFirstColumnFalse() { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { KeepCommentsAtFirstColumn = false }; Test(policy, @"class Test @@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestKeepCommentsAfterStatement() { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { KeepCommentsAtFirstColumn = true }; diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs index d29e03730c..75f75070e9 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs @@ -1,4 +1,4 @@ -// +// // TestFormattingVisitor.cs // // Author: @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestFieldSpacesBeforeComma1() { - CSharpFormattingOptions policy = new CSharpFormattingOptions(); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.SpaceBeforeFieldDeclarationComma = false; policy.SpaceAfterFieldDeclarationComma = false; @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestFieldSpacesBeforeComma2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.SpaceBeforeFieldDeclarationComma = true; policy.SpaceAfterFieldDeclarationComma = true; @@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestFixedFieldSpacesBeforeComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.SpaceAfterFieldDeclarationComma = true; policy.SpaceBeforeFieldDeclarationComma = true; @@ -85,7 +85,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestConstFieldSpacesBeforeComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.SpaceAfterFieldDeclarationComma = false; policy.SpaceBeforeFieldDeclarationComma = false; @@ -101,7 +101,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeMethodDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodDeclarationParentheses = true; Test (policy, @"public abstract class Test @@ -117,7 +117,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeConstructorDeclarationParenthesesDestructorCase () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeConstructorDeclarationParentheses = true; Test (policy, @"class Test @@ -148,7 +148,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundMultiplicativeOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundMultiplicativeOperator = true; TestBinaryOperator (policy, "*"); @@ -158,7 +158,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundShiftOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundShiftOperator = true; TestBinaryOperator (policy, "<<"); TestBinaryOperator (policy, ">>"); @@ -167,7 +167,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundAdditiveOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundAdditiveOperator = true; TestBinaryOperator (policy, "+"); @@ -177,7 +177,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundBitwiseOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundBitwiseOperator = true; TestBinaryOperator (policy, "&"); @@ -188,7 +188,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundRelationalOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundRelationalOperator = true; TestBinaryOperator (policy, "<"); @@ -200,7 +200,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundEqualityOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundEqualityOperator = true; TestBinaryOperator (policy, "=="); @@ -210,7 +210,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAroundLogicalOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundLogicalOperator = true; TestBinaryOperator (policy, "&&"); @@ -220,7 +220,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestConditionalOperator () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeConditionalOperatorCondition = true; policy.SpaceAfterConditionalOperatorCondition = true; policy.SpaceBeforeConditionalOperatorSeparator = true; @@ -256,7 +256,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeMethodCallParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodCallParentheses = true; var result = GetResult (policy, @"class Test { @@ -288,7 +288,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinMethodCallParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinMethodCallParentheses = true; var result = GetResult (policy, @"class Test { @@ -318,7 +318,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeIfParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeIfParentheses = true; var result = GetResult (policy, @"class Test { @@ -335,7 +335,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinIfParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinIfParentheses = true; var result = GetResult (policy, @"class Test { @@ -352,7 +352,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeWhileParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeWhileParentheses = true; var result = GetResult (policy, @"class Test { @@ -369,7 +369,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinWhileParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinWhileParentheses = true; var result = GetResult (policy, @"class Test { @@ -387,7 +387,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeForParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeForParentheses = true; var result = GetResult (policy, @"class Test { @@ -404,7 +404,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinForParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinForParentheses = true; var result = GetResult (policy, @"class Test { @@ -421,7 +421,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeForeachParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeForeachParentheses = true; var result = GetResult (policy, @"class Test { @@ -438,7 +438,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinForeachParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinForeachParentheses = true; var result = GetResult (policy, @"class Test { @@ -455,7 +455,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeCatchParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeCatchParentheses = true; var result = GetResult (policy, @"class Test { @@ -472,7 +472,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinCatchParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinCatchParentheses = true; var result = GetResult (policy, @"class Test { @@ -489,7 +489,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestBeforeLockParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeLockParentheses = true; var result = GetResult (policy, @"class Test { @@ -506,7 +506,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestWithinLockParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinLockParentheses = true; var result = GetResult (policy, @"class Test { @@ -523,7 +523,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAfterForSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAfterForSemicolon = true; var result = GetResult (policy, @"class Test { @@ -541,7 +541,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesBeforeForSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeForSemicolon = true; policy.SpaceAfterForSemicolon = false; @@ -560,7 +560,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestSpacesAfterTypecast () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAfterTypecast = true; var result = GetResult (policy, @"class Test { @@ -578,7 +578,7 @@ return (Test)null; [Test()] public void TestBeforeUsingParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeUsingParentheses = true; var result = GetResult (policy, @"class Test { @@ -595,7 +595,7 @@ return (Test)null; [Test()] public void TestWithinUsingParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinUsingParentheses = true; var result = GetResult (policy, @"class Test { @@ -623,7 +623,7 @@ return (Test)null; [Test()] public void TestAroundAssignmentSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundAssignment = true; TestAssignmentOperator (policy, "="); @@ -642,7 +642,7 @@ return (Test)null; [Test()] public void TestAroundAssignmentSpaceInDeclarations () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAroundAssignment = true; var result = GetResult (policy, @"class Test { void TestMe () @@ -659,7 +659,7 @@ return (Test)null; [Test()] public void TestBeforeSwitchParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeSwitchParentheses = true; var result = GetResult (policy, @"class Test { @@ -676,7 +676,7 @@ return (Test)null; [Test()] public void TestWithinSwitchParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinSwitchParentheses = true; var result = GetResult (policy, @"class Test { @@ -693,7 +693,7 @@ return (Test)null; [Test()] public void TestWithinParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinParentheses = true; var result = GetResult (policy, @"class Test { @@ -710,7 +710,7 @@ return (Test)null; [Test()] public void TestWithinMethodDeclarationParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinMethodDeclarationParentheses = true; var result = GetResult (policy, @"class Test { @@ -726,7 +726,7 @@ return (Test)null; [Test()] public void TestWithinCastParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinCastParentheses = true; var result = GetResult (policy, @"class Test { @@ -743,7 +743,7 @@ return (Test)null; [Test()] public void TestWithinSizeOfParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinSizeOfParentheses = true; var result = GetResult (policy, @"class Test { @@ -760,7 +760,7 @@ return (Test)null; [Test()] public void TestBeforeSizeOfParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeSizeOfParentheses = true; var result = GetResult (policy, @"class Test { @@ -777,7 +777,7 @@ return (Test)null; [Test()] public void TestWithinTypeOfParenthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinTypeOfParentheses = true; var result = GetResult (policy, @"class Test { @@ -794,7 +794,7 @@ return (Test)null; [Test()] public void TestBeforeTypeOfParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeTypeOfParentheses = true; var result = GetResult (policy, @"class Test { @@ -812,7 +812,7 @@ return (Test)null; [Test()] public void TestWithinCheckedExpressionParanthesesSpace () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinCheckedExpressionParantheses = true; var result = GetResult (policy, @"class Test { @@ -841,7 +841,7 @@ return (Test)null; [Test()] public void TestSpaceBeforeNewParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeNewParentheses = true; var result = GetResult (policy, @"class Test { @@ -858,7 +858,7 @@ return (Test)null; [Test()] public void TestWithinNewParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinNewParentheses = true; var result = GetResult (policy, @"class Test { @@ -875,7 +875,7 @@ return (Test)null; [Test()] public void TestBetweenEmptyNewParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesBetweenEmptyNewParentheses = true; var result = GetResult (policy, @"class Test { @@ -892,7 +892,7 @@ return (Test)null; [Test()] public void TestBeforeNewParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeNewParameterComma = true; policy.SpaceAfterNewParameterComma = false; @@ -910,7 +910,7 @@ return (Test)null; [Test()] public void TestAfterNewParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAfterNewParameterComma = true; var result = GetResult (policy, @"class Test { @@ -927,7 +927,7 @@ return (Test)null; [Test()] public void TestFieldDeclarationComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeFieldDeclarationComma = false; policy.SpaceAfterFieldDeclarationComma = true; @@ -955,7 +955,7 @@ return (Test)null; [Test()] public void TestBeforeMethodDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodDeclarationParameterComma = true; policy.SpaceAfterMethodDeclarationParameterComma = false; @@ -976,7 +976,7 @@ return (Test)null; [Test()] public void TestAfterMethodDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodDeclarationParameterComma = false; policy.SpaceAfterMethodDeclarationParameterComma = true; @@ -997,7 +997,7 @@ return (Test)null; [Test()] public void TestSpacesInLambdaExpression () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinWhileParentheses = true; var result = GetResult (policy, @"class Test { @@ -1014,7 +1014,7 @@ return (Test)null; [Test()] public void TestBeforeLocalVariableDeclarationComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceAfterLocalVariableDeclarationComma = false; @@ -1041,7 +1041,7 @@ return (Test)null; [Test()] public void TestLocalVariableDeclarationComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceAfterLocalVariableDeclarationComma = true; @@ -1069,7 +1069,7 @@ return (Test)null; [Test()] public void TestLocalVariableWithGenerics () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceAfterLocalVariableDeclarationComma = true; @@ -1090,7 +1090,7 @@ return (Test)null; [Test()] public void TestBeforeConstructorDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeConstructorDeclarationParentheses = true; var result = GetResult (policy, @"class Test @@ -1111,7 +1111,7 @@ return (Test)null; [Test()] public void TestBeforeConstructorDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeConstructorDeclarationParameterComma = true; policy.SpaceAfterConstructorDeclarationParameterComma = false; @@ -1134,7 +1134,7 @@ return (Test)null; [Test()] public void TestAfterConstructorDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeConstructorDeclarationParameterComma = false; policy.SpaceAfterConstructorDeclarationParameterComma = true; @@ -1155,7 +1155,7 @@ return (Test)null; [Test()] public void TestWithinConstructorDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinConstructorDeclarationParentheses = true; var result = GetResult (policy, @"class Test { @@ -1171,7 +1171,7 @@ return (Test)null; [Test()] public void TestBetweenEmptyConstructorDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBetweenEmptyConstructorDeclarationParentheses = true; var result = GetResult (policy, @"class Test { @@ -1190,7 +1190,7 @@ return (Test)null; [Test()] public void TestBeforeDelegateDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeDelegateDeclarationParentheses = true; var result = GetResult (policy, @"delegate void Test();"); @@ -1201,7 +1201,7 @@ return (Test)null; [Test()] public void TestBeforeDelegateDeclarationParenthesesComplex () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeDelegateDeclarationParentheses = true; var result = GetResult (policy, "delegate void TestDelegate\t\t\t();"); @@ -1212,7 +1212,7 @@ return (Test)null; [Test()] public void TestBeforeDelegateDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeDelegateDeclarationParameterComma = true; policy.SpaceAfterDelegateDeclarationParameterComma = false; @@ -1232,7 +1232,7 @@ return (Test)null; [Test()] public void TestAfterDelegateDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeDelegateDeclarationParameterComma = false; policy.SpaceAfterDelegateDeclarationParameterComma = true; @@ -1252,7 +1252,7 @@ return (Test)null; [Test()] public void TestWithinDelegateDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinDelegateDeclarationParentheses = true; var result = GetResult (policy, @"delegate void Test (int a);"); @@ -1264,7 +1264,7 @@ return (Test)null; [Test()] public void TestBetweenEmptyDelegateDeclarationParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBetweenEmptyDelegateDeclarationParentheses = true; var result = GetResult (policy, @"delegate void Test();"); @@ -1279,7 +1279,7 @@ return (Test)null; [Test()] public void TestBeforeMethodCallParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodCallParentheses = true; var result = GetResult (policy, @"class FooBar @@ -1302,7 +1302,7 @@ return (Test)null; [Test()] public void TestBeforeMethodCallParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodCallParameterComma = true; policy.SpaceAfterMethodCallParameterComma = false; @@ -1327,7 +1327,7 @@ return (Test)null; [Test()] public void TestAfterMethodCallParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeMethodCallParameterComma = false; policy.SpaceAfterMethodCallParameterComma = true; @@ -1352,7 +1352,7 @@ return (Test)null; [Test()] public void TestWithinMethodCallParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinMethodCallParentheses = true; var result = GetResult (policy, @"class FooBar @@ -1370,7 +1370,7 @@ return (Test)null; [Test()] public void TestBetweenEmptyMethodCallParentheses () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBetweenEmptyMethodCallParentheses = true; var result = GetResult (policy, @"class FooBar @@ -1392,7 +1392,7 @@ return (Test)null; public void TestBeforeIndexerDeclarationBracket () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeIndexerDeclarationBracket = true; var result = GetResult (policy, @"class FooBar @@ -1416,7 +1416,7 @@ return (Test)null; [Test()] public void TestBeforeIndexerDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeIndexerDeclarationParameterComma = true; policy.SpaceAfterIndexerDeclarationParameterComma = false; @@ -1437,7 +1437,7 @@ return (Test)null; [Test()] public void TestAfterIndexerDeclarationParameterComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAfterIndexerDeclarationParameterComma = true; var result = GetResult (policy, @"class FooBar @@ -1456,7 +1456,7 @@ return (Test)null; [Test()] public void TestWithinIndexerDeclarationBracket () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceWithinIndexerDeclarationBracket = true; var result = GetResult (policy, @"class FooBar @@ -1479,7 +1479,7 @@ return (Test)null; [Test()] public void TestSpacesWithinBrackets () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesWithinBrackets = true; policy.SpacesBeforeBrackets = false; @@ -1503,7 +1503,7 @@ return (Test)null; [Test()] public void TestSpacesBeforeBrackets () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpacesBeforeBrackets = true; var result = GetResult (policy, @"class Test @@ -1527,7 +1527,7 @@ return (Test)null; [Test()] public void TestBeforeBracketComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeBracketComma = true; policy.SpaceAfterBracketComma = false; @@ -1546,7 +1546,7 @@ return (Test)null; [Test()] public void TestAfterBracketComma () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceAfterBracketComma = true; var result = GetResult (policy, @"class Test { @@ -1566,7 +1566,7 @@ return (Test)null; [Test()] public void TestSpacesBeforeArrayDeclarationBrackets () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.SpaceBeforeArrayDeclarationBrackets = true; var result = GetResult (policy, @"class Test { @@ -1586,7 +1586,7 @@ return (Test)null; [Test()] public void TestRemoveWhitespacesBeforeSemicolon() { - CSharpFormattingOptions policy = new CSharpFormattingOptions(); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); var result = GetResult(policy, @"class Test { void TestMe () { @@ -1601,7 +1601,7 @@ return (Test)null; [Test()] public void TestSpaceInNamedArgumentAfterDoubleColon() { - var policy = new CSharpFormattingOptions(); + var policy = FormattingOptionsFactory.CreateMono (); policy.SpaceInNamedArgumentAfterDoubleColon = true; var result = GetResult(policy, @"class Test { void TestMe () @@ -1617,7 +1617,7 @@ return (Test)null; [Test()] public void TestSpaceInNamedArgumentAfterDoubleColon2() { - var policy = new CSharpFormattingOptions(); + var policy = FormattingOptionsFactory.CreateMono (); policy.SpaceInNamedArgumentAfterDoubleColon = false; var result = GetResult(policy, @"class Test { void TestMe () diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs index fbc17ce14b..b69d3e6043 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestInvocationIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @@ -58,7 +58,7 @@ this.TestMethod (); [Test()] public void TestIndentBlocks () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentBlocks = true; var adapter = Test (policy, @@ -94,7 +94,7 @@ this.TestMethod (); [Test()] public void TestIndentBlocksCase2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentBlocks = true; var adapter = Test (policy, @@ -130,7 +130,7 @@ this.TestMethod (); [Test()] public void TestBreakIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @@ -151,7 +151,7 @@ this.TestMethod (); [Test()] public void TestBreakSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test @@ -173,7 +173,7 @@ this.TestMethod (); [Test()] public void TestCheckedIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -195,7 +195,7 @@ checked { [Test()] public void TestBaseIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -214,7 +214,7 @@ checked { [Test()] public void TestUncheckedIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -236,7 +236,7 @@ unchecked { [Test()] public void TestContinueIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -256,7 +256,7 @@ continue; [Test()] public void TestContinueSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { Test TestMethod () @@ -276,7 +276,7 @@ continue; [Test()] public void TestEmptyStatementIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -295,7 +295,7 @@ continue; [Test()] public void TestFixedStatementIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -317,7 +317,7 @@ fixed (object* obj = &obj) [Test()] public void TestFixedForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.FixedBraceForcement = BraceForcement.AddBraces; @@ -347,7 +347,7 @@ fixed (object* obj = &obj) [Test()] public void TestForeachIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test @@ -370,7 +370,7 @@ foreach (var obj in col) { [Test()] public void TestForIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -392,7 +392,7 @@ for (;;) { [Test()] public void TestGotoIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -412,7 +412,7 @@ goto label; [Test()] public void TestGotoSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { Test TestMethod () @@ -433,7 +433,7 @@ goto label; [Test()] public void TestReturnIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -453,7 +453,7 @@ goto label; [Test()] public void TestReturnSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { Test TestMethod () @@ -472,7 +472,7 @@ goto label; [Test()] public void TestLockIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -494,7 +494,7 @@ lock (this) { [Test()] public void TestThrowIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -515,7 +515,7 @@ throw new NotSupportedException (); [Test()] public void TestThrowSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { Test TestMethod () @@ -535,7 +535,7 @@ throw new NotSupportedException (); [Test()] public void TestUnsafeIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -558,7 +558,7 @@ unsafe { [Test()] public void TestUsingIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -580,7 +580,7 @@ using (var o = new MyObj()) { [Test()] public void TestUsingForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.UsingBraceForcement = BraceForcement.AddBraces; @@ -610,7 +610,7 @@ using (var o = new MyObj()) { [Test()] public void TestUsingForcementDoNotChange () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.UsingBraceForcement = BraceForcement.DoNotChange; @@ -639,7 +639,7 @@ using (var o = new MyObj()) { [Test()] public void TestUsingAlignment () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.AlignEmbeddedUsingStatements = true; policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -673,7 +673,7 @@ using (var o = new MyObj()) { [Test()] public void TestVariableDeclarationIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -693,7 +693,7 @@ Test a; [Test()] public void TestConstantVariableDeclarationIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -713,7 +713,7 @@ const int a = 5; [Test()] public void TestYieldReturnIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -733,7 +733,7 @@ yield return null; [Test()] public void TestYieldReturnSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -753,7 +753,7 @@ yield return null; [Test()] public void TestYieldBreakIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -773,7 +773,7 @@ yield break; [Test()] public void TestYieldBreakSemicolon () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -792,7 +792,7 @@ yield break; [Test()] public void TestWhileIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -815,7 +815,7 @@ while (true) [Test()] public void TestDoWhileIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test { @@ -837,7 +837,7 @@ do { [Test()] public void TestForeachBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; Test (policy, @"class Test @@ -860,7 +860,7 @@ do { [Test()] public void TestForeachBracketPlacement2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLineShifted2; Test (policy, @"class Test @@ -885,7 +885,7 @@ do { [Test()] public void TestForEachBraceForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLine; policy.ForEachBraceForcement = BraceForcement.AddBraces; @@ -917,7 +917,7 @@ do { [Test()] public void TestForBraceForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLine; policy.ForBraceForcement = BraceForcement.AddBraces; @@ -951,7 +951,7 @@ do { [Ignore("Crashes due to overlapping changes")] public void TestForEachBraceForcementRemove () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLine; policy.ForEachBraceForcement = BraceForcement.RemoveBraces; @@ -988,7 +988,7 @@ do { [Test()] public void TestIfBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1012,7 +1012,7 @@ do { [Test()] public void TestAllowIfBlockInline () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.AllowIfBlockInline = true; @@ -1082,7 +1082,7 @@ do { [Test()] public void TestIfElseBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1108,7 +1108,7 @@ do { [Ignore("Crashes due to overlapping changes")] public void TestIfForcementRemove () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLine; policy.IfElseBraceForcement = BraceForcement.RemoveBraces; @@ -1146,7 +1146,7 @@ do { [Test()] public void TestIfAlignment () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.AlignEmbeddedIfStatements = true; policy.ClassBraceStyle = BraceStyle.EndOfLine; @@ -1180,7 +1180,7 @@ if (b) { [Test()] public void TestIfForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.IfElseBraceForcement = BraceForcement.AddBraces; @@ -1207,7 +1207,7 @@ if (b) { [Test()] public void TestIfForcementWithComment () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.IfElseBraceForcement = BraceForcement.AddBraces; @@ -1234,7 +1234,7 @@ if (b) { [Test()] public void TestIfElseForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.IfElseBraceForcement = BraceForcement.AddBraces; @@ -1265,7 +1265,7 @@ if (b) { [Test()] public void TestIfElseIFForcementAdd () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.IfElseBraceForcement = BraceForcement.AddBraces; @@ -1296,7 +1296,7 @@ if (b) { [Test()] public void TestElseOnNewLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceElseOnNewLine = true; Test (policy, @"class Test @@ -1327,7 +1327,7 @@ if (b) { [Test()] public void TestElseIfOnNewLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceElseIfOnNewLine = true; Test (policy, @"class Test @@ -1358,7 +1358,7 @@ if (b) { [Test()] public void TestElseOnNewLineOff () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceElseOnNewLine = false; Test (policy, @"class Test @@ -1389,7 +1389,7 @@ if (b) { [Test()] public void TestSimpleIfElseComment () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.PlaceElseIfOnNewLine = false; // for simple statements it must be new line. @@ -1417,7 +1417,7 @@ if (b) { [Ignore("Crashes due to overlapping changes")] public void TestWhileForcementRemove () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLine; policy.WhileBraceForcement = BraceForcement.RemoveBraces; @@ -1455,7 +1455,7 @@ if (b) { [Test()] public void TestFixedBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.NextLineShifted; policy.FixedBraceForcement = BraceForcement.AddBraces; @@ -1485,7 +1485,7 @@ if (b) { [Test()] public void TestForBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; Test (policy, @"class Test @@ -1509,7 +1509,7 @@ if (b) { [Test()] public void TestCheckedBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; @@ -1534,7 +1534,7 @@ if (b) { [Test()] public void TestUncheckedBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; @@ -1559,7 +1559,7 @@ if (b) { [Test()] public void TestLockBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1587,7 +1587,7 @@ if (b) { [Test()] public void TestUnsafeBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1615,7 +1615,7 @@ if (b) { [Test()] public void TestUsingBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1643,7 +1643,7 @@ if (b) { [Test()] public void TestWhileBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1671,7 +1671,7 @@ if (b) { [Test()] public void TestDoWhileBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1699,7 +1699,7 @@ if (b) { [Test()] public void TestSwitchFormatting1 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentSwitchBody = true; policy.IndentCaseBody = true; @@ -1732,7 +1732,7 @@ if (b) { [Test()] public void TestSwitchFormatting2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentSwitchBody = false; policy.IndentCaseBody = false; @@ -1766,7 +1766,7 @@ if (b) { [Test()] public void TestSwitchIndentBreak () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentSwitchBody = true; policy.IndentBreakStatements = true; @@ -1840,7 +1840,7 @@ if (b) { [Test()] public void TestTryCatchBracketPlacement () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.StatementBraceStyle = BraceStyle.EndOfLine; @@ -1867,7 +1867,7 @@ if (b) { [Test()] public void TestPlaceCatchOnNewLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceCatchOnNewLine = true; @@ -1899,7 +1899,7 @@ if (b) { [Test()] public void TestPlaceFinallyOnNewLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceFinallyOnNewLine = true; Test (policy, @"class Test @@ -1930,7 +1930,7 @@ if (b) { [Test()] public void TestPlaceWhileOnNewLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PlaceWhileOnNewLine = true; @@ -1958,7 +1958,7 @@ if (b) { [Test()] public void TestBlockStatementWithComments () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { @@ -1986,7 +1986,7 @@ if (b) { [Test()] public void TestBlockStatementWithPreProcessorDirective () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test { diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index d6fd269a09..ae6467a0b7 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestClassIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.DoNotChange; Test (policy, @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestAttributeIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.DoNotChange; Test (policy, @@ -63,7 +63,7 @@ class Test {}"); [Test()] public void TestClassIndentationInNamespaces () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.DoNotChange; @@ -77,7 +77,7 @@ class Test {}"); [Test()] public void TestNoIndentationInNamespaces () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.IndentNamespaceBody = false; @@ -92,7 +92,7 @@ class Test {} [Test()] public void TestClassIndentationInNamespacesCase2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.NamespaceBraceStyle = BraceStyle.NextLine; policy.ClassBraceStyle = BraceStyle.NextLine; policy.ConstructorBraceStyle = BraceStyle.NextLine; @@ -122,7 +122,7 @@ namespace MonoDevelop.CSharp.Formatting [Test()] public void TestIndentClassBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentClassBody = true; Test (policy, @"class Test @@ -148,7 +148,7 @@ Test a; [Test()] public void TestIndentInterfaceBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentInterfaceBody = true; Test (policy, @@ -173,7 +173,7 @@ Test Foo (); [Test()] public void TestIndentStructBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentStructBody = true; Test (policy, @@ -198,7 +198,7 @@ Test Foo (); [Test()] public void TestIndentEnumBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentEnumBody = true; Test (policy, @@ -223,7 +223,7 @@ A [Test()] public void TestIndentMethodBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentMethodBody = true; Test (policy, @@ -266,7 +266,7 @@ A [Test()] public void TestIndentMethodBodyOperatorCase () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentMethodBody = true; var adapter = Test (policy, @@ -300,7 +300,7 @@ A [Test()] public void TestIndentPropertyBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentPropertyBody = true; var adapter = Test (policy, @@ -333,7 +333,7 @@ set; [Test()] public void TestIndentPropertyOneLine () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.AllowPropertyGetBlockInline = true; policy.AllowPropertySetBlockInline = true; @@ -352,7 +352,7 @@ set; [Test()] public void TestIndentPropertyOneLineCase2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.AllowPropertyGetBlockInline = true; policy.AllowPropertySetBlockInline = true; @@ -371,7 +371,7 @@ set; [Test()] public void TestIndentPropertyBodyIndexerCase () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentPropertyBody = true; var adapter = Test (policy, @@ -415,7 +415,7 @@ set { [Test()] public void TestPropertyAlignment () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; var adapter = Test (policy, @"class Test @@ -448,7 +448,7 @@ set { [Test()] public void TestIndentNamespaceBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.IndentNamespaceBody = true; @@ -471,7 +471,7 @@ class FooBar {} [Test()] public void TestMethodIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.MethodBraceStyle = BraceStyle.DoNotChange; Test (policy, @@ -488,7 +488,7 @@ MyType TestMethod () {} [Test()] public void TestPropertyIndentation () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.PropertyBraceStyle = BraceStyle.DoNotChange; Test (policy, @@ -504,7 +504,7 @@ MyType TestMethod () {} [Test()] public void TestPropertyIndentationCase2 () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); Test (policy, @"class Test @@ -527,7 +527,7 @@ set; [Test()] public void TestIndentEventBody () { - CSharpFormattingOptions policy = new CSharpFormattingOptions (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); policy.IndentEventBody = true; var adapter = Test (policy, diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs index c2c7f05902..0932b2d4fa 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestInitializerWrapAlways() { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { ArrayInitializerWrapping = Wrapping.WrapAlways }; @@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestInitializerDoNotWrap() { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { ArrayInitializerWrapping = Wrapping.DoNotWrap }; @@ -91,7 +91,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests [Test()] public void TestInitializerBraceStyle() { - var policy = new CSharpFormattingOptions() { + var policy = FormattingOptionsFactory.CreateMonoOptions () { ArrayInitializerWrapping = Wrapping.WrapAlways, ArrayInitializerBraceStyle = BraceStyle.NextLine }; diff --git a/ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs b/ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs index 5b2a55bbb3..4eee3903e2 100644 --- a/ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs +++ b/ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs @@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.VB.Ast //// if (IsNull) //// return "Null"; //// StringWriter w = new StringWriter(); -//// AcceptVisitor(new OutputVisitor(w, new CSharpFormattingOptions()), null); +//// AcceptVisitor(new OutputVisitor(w, FormattingOptionsFactory.CreateMonoOptions ()), null); //// string text = w.ToString().TrimEnd().Replace("\t", "").Replace(w.NewLine, " "); //// if (text.Length > 100) //// return text.Substring(0, 97) + "...";