Browse Source

Added formatting factory - formatting options should be created with

that.
newNRvisualizers
Mike Krüger 13 years ago
parent
commit
04f8720739
  1. 4
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs
  2. 2
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  3. 117
      ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs
  4. 339
      ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs
  5. 1
      ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj
  6. 4
      ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs
  7. 4
      ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs
  8. 4
      ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs
  9. 4
      ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs
  10. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs
  11. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs
  12. 2
      ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs
  13. 16
      ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs
  14. 36
      ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs
  15. 18
      ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs
  16. 6
      ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs
  17. 172
      ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs
  18. 144
      ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs
  19. 42
      ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs
  20. 6
      ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs
  21. 2
      ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs

4
ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

@ -1,4 +1,4 @@
// //
// AstNode.cs // AstNode.cs
// //
// Author: // Author:
@ -831,7 +831,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (IsNull) if (IsNull)
return ""; return "";
var w = new StringWriter (); var w = new StringWriter ();
AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? new CSharpFormattingOptions ())); AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? FormattingOptionsFactory.CreateMono ()));
return w.ToString (); return w.ToString ();
} }

2
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs

@ -68,7 +68,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
this.document = document; this.document = document;
this.factory = factory; this.factory = factory;
// Set defaults for additional input properties // Set defaults for additional input properties
this.FormattingPolicy = new CSharpFormattingOptions (); this.FormattingPolicy = FormattingOptionsFactory.CreateMono ();
this.EolMarker = Environment.NewLine; this.EolMarker = Environment.NewLine;
this.IndentString = "\t"; this.IndentString = "\t";
} }

117
ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormattingOptions.cs

@ -788,121 +788,8 @@ namespace ICSharpCode.NRefactory.CSharp
#endregion #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) /*public static CSharpFormattingOptions Load (FilePath selectedFile)
@ -914,7 +801,7 @@ namespace ICSharpCode.NRefactory.CSharp
public static CSharpFormattingOptions Load (System.IO.Stream input) public static CSharpFormattingOptions Load (System.IO.Stream input)
{ {
CSharpFormattingOptions result = new CSharpFormattingOptions (); CSharpFormattingOptions result = FormattingOptionsFactory.CreateMonoOptions ();
result.Name = "noname"; result.Name = "noname";
using (XmlTextReader reader = new XmlTextReader (input)) { using (XmlTextReader reader = new XmlTextReader (input)) {
while (reader.Read ()) { while (reader.Read ()) {

339
ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs

@ -0,0 +1,339 @@
//
// FormattingOptionsFactory.cs
//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
//
// 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
{
/// <summary>
/// The formatting options factory creates pre defined formatting option styles.
/// </summary>
public static class FormattingOptionsFactory
{
/// <summary>
/// Creates empty CSharpFormatting options.
/// </summary>
public static CSharpFormattingOptions CreateEmpty()
{
return new CSharpFormattingOptions();
}
/// <summary>
/// Creates mono indent style CSharpFormatting options.
/// </summary>
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,
};
}
/// <summary>
/// Creates sharp develop indent style CSharpFormatting options.
/// </summary>
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,
};
}
/// <summary>
/// Creates allman indent style CSharpFormatting options used in Visual Studio.
/// </summary>
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;
}
}
}

1
ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj

@ -368,6 +368,7 @@
<Compile Include="Ast\GeneralScope\NewLineNode.cs" /> <Compile Include="Ast\GeneralScope\NewLineNode.cs" />
<Compile Include="Ast\GeneralScope\WhitespaceNode.cs" /> <Compile Include="Ast\GeneralScope\WhitespaceNode.cs" />
<Compile Include="Ast\GeneralScope\TextNode.cs" /> <Compile Include="Ast\GeneralScope\TextNode.cs" />
<Compile Include="Formatter\FormattingOptionsFactory.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">

4
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 // 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 // software and associated documentation files (the "Software"), to deal in the Software
@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.CSharp
throw new ArgumentNullException("entity"); throw new ArgumentNullException("entity");
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
ConvertEntity(entity, new TextWriterOutputFormatter(writer), new CSharpFormattingOptions()); ConvertEntity(entity, new TextWriterOutputFormatter(writer), FormattingOptionsFactory.CreateMono ());
return writer.ToString(); return writer.ToString();
} }

4
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 // 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 // software and associated documentation files (the "Software"), to deal in the Software
@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp
string MakeSnippet(AstNode node) string MakeSnippet(AstNode node)
{ {
StringWriter w = new StringWriter(); StringWriter w = new StringWriter();
CSharpOutputVisitor v = new CSharpOutputVisitor(w, new CSharpFormattingOptions()); CSharpOutputVisitor v = new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ());
node.AcceptVisitor(v); node.AcceptVisitor(v);
return w.ToString(); return w.ToString();
} }

4
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 // 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 // software and associated documentation files (the "Software"), to deal in the Software
@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck
// 2. Output // 2. Output
StringWriter w = new StringWriter(); StringWriter w = new StringWriter();
cu.AcceptVisitor(new CSharpOutputVisitor(w, new CSharpFormattingOptions())); cu.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ()));
string generatedCode = w.ToString().TrimEnd(); string generatedCode = w.ToString().TrimEnd();
// 3. Compare output with original (modulo whitespaces) // 3. Compare output with original (modulo whitespaces)

4
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 // 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 // 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) void AssertOutput(string expected, AstNode node, CSharpFormattingOptions policy = null)
{ {
if (policy == null) if (policy == null)
policy = new CSharpFormattingOptions(); policy = FormattingOptionsFactory.CreateMono();
StringWriter w = new StringWriter(); StringWriter w = new StringWriter();
w.NewLine = "\n"; w.NewLine = "\n";
node.AcceptVisitor(new CSharpOutputVisitor(new TextWriterOutputFormatter(w) { IndentationString = "$" }, policy)); node.AcceptVisitor(new CSharpOutputVisitor(new TextWriterOutputFormatter(w) { IndentationString = "$" }, policy));

6
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs

@ -1,4 +1,4 @@
// //
// TestRefactoringContext.cs // TestRefactoringContext.cs
// //
// Author: // Author:
@ -84,7 +84,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
sealed class TestScript : DocumentScript sealed class TestScript : DocumentScript
{ {
readonly TestRefactoringContext context; 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; this.context = context;
} }
@ -265,7 +265,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
internal static void Print (AstNode node) 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); node.AcceptVisitor (v);
} }
} }

6
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

@ -1,4 +1,4 @@
// //
// CodeCompletionBugTests.cs // CodeCompletionBugTests.cs
// //
// Author: // Author:
@ -241,7 +241,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion
var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, rctx, compilationUnit, parsedFile); var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, rctx, compilationUnit, parsedFile);
engine.EolMarker = Environment.NewLine; engine.EolMarker = Environment.NewLine;
engine.FormattingPolicy = new CSharpFormattingOptions (); engine.FormattingPolicy = FormattingOptionsFactory.CreateMono ();
var data = engine.GetCompletionData (cursorPosition, isCtrlSpace); 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); var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, new CSharpTypeResolveContext (cmp.MainAssembly), compilationUnit, parsedFile);
engine.EolMarker = Environment.NewLine; engine.EolMarker = Environment.NewLine;
engine.FormattingPolicy = new CSharpFormattingOptions (); engine.FormattingPolicy = FormattingOptionsFactory.CreateMono ();
return Tuple.Create (doc, engine); return Tuple.Create (doc, engine);
} }

2
ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.CSharp
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
policy = new CSharpFormattingOptions(); policy = FormattingOptionsFactory.CreateMono ();
} }
string InsertReadable(Expression expr) string InsertReadable(Expression expr)

16
ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs

@ -1,4 +1,4 @@
// //
// TastBlankLineFormatting.cs // TastBlankLineFormatting.cs
// //
// Author: // Author:
@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBlankLinesAfterUsings () public void TestBlankLinesAfterUsings ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesAfterUsings = 2; policy.BlankLinesAfterUsings = 2;
var adapter = Test (policy, @"using System; var adapter = Test (policy, @"using System;
@ -65,7 +65,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBeforeUsings () public void TestBlankLinesBeforeUsings ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesAfterUsings = 0; policy.BlankLinesAfterUsings = 0;
policy.BlankLinesBeforeUsings = 2; policy.BlankLinesBeforeUsings = 2;
@ -94,7 +94,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBeforeFirstDeclaration () public void TestBlankLinesBeforeFirstDeclaration ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBeforeFirstDeclaration = 2; policy.BlankLinesBeforeFirstDeclaration = 2;
var adapter = Test (policy, @"namespace Test var adapter = Test (policy, @"namespace Test
@ -125,7 +125,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBetweenTypes () public void TestBlankLinesBetweenTypes ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBetweenTypes = 1; policy.BlankLinesBetweenTypes = 1;
var adapter = Test (policy, @"namespace Test var adapter = Test (policy, @"namespace Test
@ -173,7 +173,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBetweenFields () public void TestBlankLinesBetweenFields ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBetweenFields = 1; policy.BlankLinesBetweenFields = 1;
var adapter = Test (policy, @"class Test var adapter = Test (policy, @"class Test
@ -203,7 +203,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBetweenEventFields () public void TestBlankLinesBetweenEventFields ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBetweenEventFields = 1; policy.BlankLinesBetweenEventFields = 1;
var adapter = Test (policy, @"class Test var adapter = Test (policy, @"class Test
@ -234,7 +234,7 @@ namespace Test
[Test()] [Test()]
public void TestBlankLinesBetweenMembers () public void TestBlankLinesBetweenMembers ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBetweenMembers = 1; policy.BlankLinesBetweenMembers = 1;
var adapter = Test (policy, @"class Test var adapter = Test (policy, @"class Test

36
ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestNamespaceBraceStyle () public void TestNamespaceBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
@ -68,7 +68,7 @@ namespace B {
[Test()] [Test()]
public void TestAnonymousMethodBraceStyle () public void TestAnonymousMethodBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.AnonymousMethodBraceStyle = BraceStyle.EndOfLine; policy.AnonymousMethodBraceStyle = BraceStyle.EndOfLine;
Test (policy, Test (policy,
@ -91,7 +91,7 @@ namespace B {
[Test()] [Test()]
public void TestClassBraceStlye () public void TestClassBraceStlye ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, Test (policy,
@ -103,7 +103,7 @@ namespace B {
[Test()] [Test()]
public void TestStructBraceStyle () public void TestStructBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StructBraceStyle = BraceStyle.NextLine; policy.StructBraceStyle = BraceStyle.NextLine;
Test (policy, Test (policy,
@ -116,7 +116,7 @@ namespace B {
[Test()] [Test()]
public void TestInterfaceBraceStyle () public void TestInterfaceBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.InterfaceBraceStyle = BraceStyle.NextLine; policy.InterfaceBraceStyle = BraceStyle.NextLine;
Test (policy, Test (policy,
@ -129,7 +129,7 @@ namespace B {
[Test()] [Test()]
public void TestEnumBraceStyle () public void TestEnumBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.EnumBraceStyle = BraceStyle.NextLineShifted; policy.EnumBraceStyle = BraceStyle.NextLineShifted;
Test (policy, @"enum Test { Test (policy, @"enum Test {
@ -144,7 +144,7 @@ namespace B {
[Test()] [Test()]
public void TestMethodBraceStlye () public void TestMethodBraceStlye ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.MethodBraceStyle = BraceStyle.NextLine; policy.MethodBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -162,7 +162,7 @@ namespace B {
[Test()] [Test()]
public void TestConstructorBraceStyle () public void TestConstructorBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ConstructorBraceStyle = BraceStyle.NextLine; policy.ConstructorBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -180,7 +180,7 @@ namespace B {
[Test()] [Test()]
public void TestDestructorBraceStyle () public void TestDestructorBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.DestructorBraceStyle = BraceStyle.NextLine; policy.DestructorBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -198,7 +198,7 @@ namespace B {
[Test()] [Test()]
public void TestPropertyBraceStyle () public void TestPropertyBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyBraceStyle = BraceStyle.NextLine; policy.PropertyBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -221,7 +221,7 @@ namespace B {
[Test()] [Test()]
public void TestPropertyGetBraceStyle () public void TestPropertyGetBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyGetBraceStyle = BraceStyle.NextLine; policy.PropertyGetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -249,7 +249,7 @@ namespace B {
public void TestAllowPropertyGetBlockInline () public void TestAllowPropertyGetBlockInline ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange; policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = true; policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = false; policy.AllowPropertySetBlockInline = false;
@ -289,7 +289,7 @@ namespace B {
[Test()] [Test()]
public void TestAllowPropertySetBlockInline () public void TestAllowPropertySetBlockInline ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange; policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = false; policy.AllowPropertyGetBlockInline = false;
policy.AllowPropertySetBlockInline = true; policy.AllowPropertySetBlockInline = true;
@ -329,7 +329,7 @@ namespace B {
[Test()] [Test()]
public void TestPropertySetBraceStyle () public void TestPropertySetBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertySetBraceStyle = BraceStyle.NextLine; policy.PropertySetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -356,7 +356,7 @@ namespace B {
[Test()] [Test()]
public void TestEventBraceStyle () public void TestEventBraceStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.EventBraceStyle = BraceStyle.NextLine; policy.EventBraceStyle = BraceStyle.NextLine;
policy.EventAddBraceStyle = BraceStyle.NextLine; policy.EventAddBraceStyle = BraceStyle.NextLine;
policy.EventRemoveBraceStyle = BraceStyle.NextLine; policy.EventRemoveBraceStyle = BraceStyle.NextLine;
@ -387,7 +387,7 @@ namespace B {
[Test()] [Test()]
public void TestAllowEventAddBlockInline () public void TestAllowEventAddBlockInline ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.AllowEventAddBlockInline = true; policy.AllowEventAddBlockInline = true;
policy.AllowEventRemoveBlockInline = false; policy.AllowEventRemoveBlockInline = false;
@ -412,7 +412,7 @@ namespace B {
[Test()] [Test()]
public void TestAllowEventRemoveBlockInline () public void TestAllowEventRemoveBlockInline ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.AllowEventAddBlockInline = false; policy.AllowEventAddBlockInline = false;
policy.AllowEventRemoveBlockInline = true; policy.AllowEventRemoveBlockInline = true;
@ -437,7 +437,7 @@ namespace B {
[Test()] [Test()]
public void TestTryCatchWithBannerStyle () public void TestTryCatchWithBannerStyle ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.BannerStyle; policy.StatementBraceStyle = BraceStyle.BannerStyle;
Test (policy, @"class Test Test (policy, @"class Test
{ {

18
ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs

@ -1,4 +1,4 @@
// //
// TestFormattingBugs.cs // TestFormattingBugs.cs
// //
// Author: // Author:
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBug325187 () public void TestBug325187 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceElseOnNewLine = true; policy.PlaceElseOnNewLine = true;
TestStatementFormatting (policy, TestStatementFormatting (policy,
@ -62,7 +62,7 @@ Console.WriteLine (""Bad indent"");",
[Test()] [Test()]
public void TestBug415469 () public void TestBug415469 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
TestStatementFormatting (policy, TestStatementFormatting (policy,
@"switch (condition) { @"switch (condition) {
@ -86,7 +86,7 @@ case CONDITION2:
[Test()] [Test()]
public void TestBug540043 () public void TestBug540043 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
TestStatementFormatting (policy, TestStatementFormatting (policy,
@"using (IDisposable a = null) @"using (IDisposable a = null)
@ -105,7 +105,7 @@ using (IDisposable b = null) {
[Test()] [Test()]
public void TestBug655635 () public void TestBug655635 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
TestStatementFormatting (policy, TestStatementFormatting (policy,
@"try { @"try {
@ -145,7 +145,7 @@ using (IDisposable b = null) {
[Test()] [Test()]
public void TestBug659675 () public void TestBug659675 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
TestStatementFormatting (policy, "@string=@int;", "@string = @int;"); TestStatementFormatting (policy, "@string=@int;", "@string = @int;");
} }
@ -155,7 +155,7 @@ using (IDisposable b = null) {
[Test()] [Test()]
public void TestBug670213 () public void TestBug670213 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.MethodBraceStyle = BraceStyle.EndOfLine; policy.MethodBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -178,7 +178,7 @@ using (IDisposable b = null) {
[Test()] [Test()]
public void TestBug677261 () public void TestBug677261 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ConstructorBraceStyle = BraceStyle.EndOfLine; policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -200,7 +200,7 @@ using (IDisposable b = null) {
[Test()] [Test()]
public void TestBug3586 () public void TestBug3586 ()
{ {
var policy = new CSharpFormattingOptions (); var policy = FormattingOptionsFactory.CreateMono ();
policy.ConstructorBraceStyle = BraceStyle.EndOfLine; policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"public class A Test (policy, @"public class A

6
ICSharpCode.NRefactory.Tests/FormattingTests/TestKeepReformattingRules.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestKeepCommentsAtFirstColumnTrue () public void TestKeepCommentsAtFirstColumnTrue ()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
KeepCommentsAtFirstColumn = true KeepCommentsAtFirstColumn = true
}; };
@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestKeepCommentsAtFirstColumnFalse() public void TestKeepCommentsAtFirstColumnFalse()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
KeepCommentsAtFirstColumn = false KeepCommentsAtFirstColumn = false
}; };
Test(policy, @"class Test Test(policy, @"class Test
@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestKeepCommentsAfterStatement() public void TestKeepCommentsAfterStatement()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
KeepCommentsAtFirstColumn = true KeepCommentsAtFirstColumn = true
}; };

172
ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs

@ -1,4 +1,4 @@
// //
// TestFormattingVisitor.cs // TestFormattingVisitor.cs
// //
// Author: // Author:
@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestFieldSpacesBeforeComma1() public void TestFieldSpacesBeforeComma1()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions(); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.SpaceBeforeFieldDeclarationComma = false; policy.SpaceBeforeFieldDeclarationComma = false;
policy.SpaceAfterFieldDeclarationComma = false; policy.SpaceAfterFieldDeclarationComma = false;
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestFieldSpacesBeforeComma2 () public void TestFieldSpacesBeforeComma2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.SpaceBeforeFieldDeclarationComma = true; policy.SpaceBeforeFieldDeclarationComma = true;
policy.SpaceAfterFieldDeclarationComma = true; policy.SpaceAfterFieldDeclarationComma = true;
@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestFixedFieldSpacesBeforeComma () public void TestFixedFieldSpacesBeforeComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.SpaceAfterFieldDeclarationComma = true; policy.SpaceAfterFieldDeclarationComma = true;
policy.SpaceBeforeFieldDeclarationComma = true; policy.SpaceBeforeFieldDeclarationComma = true;
@ -85,7 +85,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestConstFieldSpacesBeforeComma () public void TestConstFieldSpacesBeforeComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.SpaceAfterFieldDeclarationComma = false; policy.SpaceAfterFieldDeclarationComma = false;
policy.SpaceBeforeFieldDeclarationComma = false; policy.SpaceBeforeFieldDeclarationComma = false;
@ -101,7 +101,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeMethodDeclarationParentheses () public void TestBeforeMethodDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodDeclarationParentheses = true; policy.SpaceBeforeMethodDeclarationParentheses = true;
Test (policy, @"public abstract class Test Test (policy, @"public abstract class Test
@ -117,7 +117,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeConstructorDeclarationParenthesesDestructorCase () public void TestBeforeConstructorDeclarationParenthesesDestructorCase ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeConstructorDeclarationParentheses = true; policy.SpaceBeforeConstructorDeclarationParentheses = true;
Test (policy, @"class Test Test (policy, @"class Test
@ -148,7 +148,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundMultiplicativeOperator () public void TestSpacesAroundMultiplicativeOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundMultiplicativeOperator = true; policy.SpaceAroundMultiplicativeOperator = true;
TestBinaryOperator (policy, "*"); TestBinaryOperator (policy, "*");
@ -158,7 +158,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundShiftOperator () public void TestSpacesAroundShiftOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundShiftOperator = true; policy.SpaceAroundShiftOperator = true;
TestBinaryOperator (policy, "<<"); TestBinaryOperator (policy, "<<");
TestBinaryOperator (policy, ">>"); TestBinaryOperator (policy, ">>");
@ -167,7 +167,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundAdditiveOperator () public void TestSpacesAroundAdditiveOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundAdditiveOperator = true; policy.SpaceAroundAdditiveOperator = true;
TestBinaryOperator (policy, "+"); TestBinaryOperator (policy, "+");
@ -177,7 +177,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundBitwiseOperator () public void TestSpacesAroundBitwiseOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundBitwiseOperator = true; policy.SpaceAroundBitwiseOperator = true;
TestBinaryOperator (policy, "&"); TestBinaryOperator (policy, "&");
@ -188,7 +188,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundRelationalOperator () public void TestSpacesAroundRelationalOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundRelationalOperator = true; policy.SpaceAroundRelationalOperator = true;
TestBinaryOperator (policy, "<"); TestBinaryOperator (policy, "<");
@ -200,7 +200,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundEqualityOperator () public void TestSpacesAroundEqualityOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundEqualityOperator = true; policy.SpaceAroundEqualityOperator = true;
TestBinaryOperator (policy, "=="); TestBinaryOperator (policy, "==");
@ -210,7 +210,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAroundLogicalOperator () public void TestSpacesAroundLogicalOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundLogicalOperator = true; policy.SpaceAroundLogicalOperator = true;
TestBinaryOperator (policy, "&&"); TestBinaryOperator (policy, "&&");
@ -220,7 +220,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestConditionalOperator () public void TestConditionalOperator ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeConditionalOperatorCondition = true; policy.SpaceBeforeConditionalOperatorCondition = true;
policy.SpaceAfterConditionalOperatorCondition = true; policy.SpaceAfterConditionalOperatorCondition = true;
policy.SpaceBeforeConditionalOperatorSeparator = true; policy.SpaceBeforeConditionalOperatorSeparator = true;
@ -256,7 +256,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeMethodCallParenthesesSpace () public void TestBeforeMethodCallParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodCallParentheses = true; policy.SpaceBeforeMethodCallParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -288,7 +288,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinMethodCallParenthesesSpace () public void TestWithinMethodCallParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinMethodCallParentheses = true; policy.SpaceWithinMethodCallParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -318,7 +318,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeIfParenthesesSpace () public void TestBeforeIfParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeIfParentheses = true; policy.SpaceBeforeIfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -335,7 +335,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinIfParenthesesSpace () public void TestWithinIfParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinIfParentheses = true; policy.SpacesWithinIfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -352,7 +352,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeWhileParenthesesSpace () public void TestBeforeWhileParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeWhileParentheses = true; policy.SpaceBeforeWhileParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -369,7 +369,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinWhileParenthesesSpace () public void TestWithinWhileParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinWhileParentheses = true; policy.SpacesWithinWhileParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -387,7 +387,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeForParenthesesSpace () public void TestBeforeForParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeForParentheses = true; policy.SpaceBeforeForParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -404,7 +404,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinForParenthesesSpace () public void TestWithinForParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinForParentheses = true; policy.SpacesWithinForParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -421,7 +421,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeForeachParenthesesSpace () public void TestBeforeForeachParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeForeachParentheses = true; policy.SpaceBeforeForeachParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -438,7 +438,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinForeachParenthesesSpace () public void TestWithinForeachParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinForeachParentheses = true; policy.SpacesWithinForeachParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -455,7 +455,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeCatchParenthesesSpace () public void TestBeforeCatchParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeCatchParentheses = true; policy.SpaceBeforeCatchParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -472,7 +472,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinCatchParenthesesSpace () public void TestWithinCatchParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinCatchParentheses = true; policy.SpacesWithinCatchParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -489,7 +489,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestBeforeLockParenthesesSpace () public void TestBeforeLockParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeLockParentheses = true; policy.SpaceBeforeLockParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -506,7 +506,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestWithinLockParenthesesSpace () public void TestWithinLockParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinLockParentheses = true; policy.SpacesWithinLockParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -523,7 +523,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAfterForSemicolon () public void TestSpacesAfterForSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAfterForSemicolon = true; policy.SpaceAfterForSemicolon = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -541,7 +541,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesBeforeForSemicolon () public void TestSpacesBeforeForSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeForSemicolon = true; policy.SpaceBeforeForSemicolon = true;
policy.SpaceAfterForSemicolon = false; policy.SpaceAfterForSemicolon = false;
@ -560,7 +560,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestSpacesAfterTypecast () public void TestSpacesAfterTypecast ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAfterTypecast = true; policy.SpaceAfterTypecast = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -578,7 +578,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeUsingParenthesesSpace () public void TestBeforeUsingParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeUsingParentheses = true; policy.SpaceBeforeUsingParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -595,7 +595,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinUsingParenthesesSpace () public void TestWithinUsingParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinUsingParentheses = true; policy.SpacesWithinUsingParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -623,7 +623,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAroundAssignmentSpace () public void TestAroundAssignmentSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundAssignment = true; policy.SpaceAroundAssignment = true;
TestAssignmentOperator (policy, "="); TestAssignmentOperator (policy, "=");
@ -642,7 +642,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAroundAssignmentSpaceInDeclarations () public void TestAroundAssignmentSpaceInDeclarations ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAroundAssignment = true; policy.SpaceAroundAssignment = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
void TestMe () void TestMe ()
@ -659,7 +659,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeSwitchParenthesesSpace () public void TestBeforeSwitchParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeSwitchParentheses = true; policy.SpaceBeforeSwitchParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -676,7 +676,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinSwitchParenthesesSpace () public void TestWithinSwitchParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinSwitchParentheses = true; policy.SpacesWithinSwitchParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -693,7 +693,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinParenthesesSpace () public void TestWithinParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinParentheses = true; policy.SpacesWithinParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -710,7 +710,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinMethodDeclarationParenthesesSpace () public void TestWithinMethodDeclarationParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinMethodDeclarationParentheses = true; policy.SpaceWithinMethodDeclarationParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -726,7 +726,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinCastParenthesesSpace () public void TestWithinCastParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinCastParentheses = true; policy.SpacesWithinCastParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -743,7 +743,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinSizeOfParenthesesSpace () public void TestWithinSizeOfParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinSizeOfParentheses = true; policy.SpacesWithinSizeOfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -760,7 +760,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeSizeOfParentheses () public void TestBeforeSizeOfParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeSizeOfParentheses = true; policy.SpaceBeforeSizeOfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -777,7 +777,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinTypeOfParenthesesSpace () public void TestWithinTypeOfParenthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinTypeOfParentheses = true; policy.SpacesWithinTypeOfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -794,7 +794,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeTypeOfParentheses () public void TestBeforeTypeOfParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeTypeOfParentheses = true; policy.SpaceBeforeTypeOfParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -812,7 +812,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinCheckedExpressionParanthesesSpace () public void TestWithinCheckedExpressionParanthesesSpace ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinCheckedExpressionParantheses = true; policy.SpacesWithinCheckedExpressionParantheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -841,7 +841,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpaceBeforeNewParentheses () public void TestSpaceBeforeNewParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeNewParentheses = true; policy.SpaceBeforeNewParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -858,7 +858,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinNewParentheses () public void TestWithinNewParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinNewParentheses = true; policy.SpacesWithinNewParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -875,7 +875,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBetweenEmptyNewParentheses () public void TestBetweenEmptyNewParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesBetweenEmptyNewParentheses = true; policy.SpacesBetweenEmptyNewParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -892,7 +892,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeNewParameterComma () public void TestBeforeNewParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeNewParameterComma = true; policy.SpaceBeforeNewParameterComma = true;
policy.SpaceAfterNewParameterComma = false; policy.SpaceAfterNewParameterComma = false;
@ -910,7 +910,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterNewParameterComma () public void TestAfterNewParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAfterNewParameterComma = true; policy.SpaceAfterNewParameterComma = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -927,7 +927,7 @@ return (Test)null;
[Test()] [Test()]
public void TestFieldDeclarationComma () public void TestFieldDeclarationComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeFieldDeclarationComma = false; policy.SpaceBeforeFieldDeclarationComma = false;
policy.SpaceAfterFieldDeclarationComma = true; policy.SpaceAfterFieldDeclarationComma = true;
@ -955,7 +955,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeMethodDeclarationParameterComma () public void TestBeforeMethodDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodDeclarationParameterComma = true; policy.SpaceBeforeMethodDeclarationParameterComma = true;
policy.SpaceAfterMethodDeclarationParameterComma = false; policy.SpaceAfterMethodDeclarationParameterComma = false;
@ -976,7 +976,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterMethodDeclarationParameterComma () public void TestAfterMethodDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodDeclarationParameterComma = false; policy.SpaceBeforeMethodDeclarationParameterComma = false;
policy.SpaceAfterMethodDeclarationParameterComma = true; policy.SpaceAfterMethodDeclarationParameterComma = true;
@ -997,7 +997,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpacesInLambdaExpression () public void TestSpacesInLambdaExpression ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinWhileParentheses = true; policy.SpacesWithinWhileParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -1014,7 +1014,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeLocalVariableDeclarationComma () public void TestBeforeLocalVariableDeclarationComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceBeforeLocalVariableDeclarationComma = true;
policy.SpaceAfterLocalVariableDeclarationComma = false; policy.SpaceAfterLocalVariableDeclarationComma = false;
@ -1041,7 +1041,7 @@ return (Test)null;
[Test()] [Test()]
public void TestLocalVariableDeclarationComma () public void TestLocalVariableDeclarationComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceBeforeLocalVariableDeclarationComma = true;
policy.SpaceAfterLocalVariableDeclarationComma = true; policy.SpaceAfterLocalVariableDeclarationComma = true;
@ -1069,7 +1069,7 @@ return (Test)null;
[Test()] [Test()]
public void TestLocalVariableWithGenerics () public void TestLocalVariableWithGenerics ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeLocalVariableDeclarationComma = true; policy.SpaceBeforeLocalVariableDeclarationComma = true;
policy.SpaceAfterLocalVariableDeclarationComma = true; policy.SpaceAfterLocalVariableDeclarationComma = true;
@ -1090,7 +1090,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeConstructorDeclarationParentheses () public void TestBeforeConstructorDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeConstructorDeclarationParentheses = true; policy.SpaceBeforeConstructorDeclarationParentheses = true;
var result = GetResult (policy, @"class Test var result = GetResult (policy, @"class Test
@ -1111,7 +1111,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeConstructorDeclarationParameterComma () public void TestBeforeConstructorDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeConstructorDeclarationParameterComma = true; policy.SpaceBeforeConstructorDeclarationParameterComma = true;
policy.SpaceAfterConstructorDeclarationParameterComma = false; policy.SpaceAfterConstructorDeclarationParameterComma = false;
@ -1134,7 +1134,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterConstructorDeclarationParameterComma () public void TestAfterConstructorDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeConstructorDeclarationParameterComma = false; policy.SpaceBeforeConstructorDeclarationParameterComma = false;
policy.SpaceAfterConstructorDeclarationParameterComma = true; policy.SpaceAfterConstructorDeclarationParameterComma = true;
@ -1155,7 +1155,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinConstructorDeclarationParentheses () public void TestWithinConstructorDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinConstructorDeclarationParentheses = true; policy.SpaceWithinConstructorDeclarationParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -1171,7 +1171,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBetweenEmptyConstructorDeclarationParentheses () public void TestBetweenEmptyConstructorDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBetweenEmptyConstructorDeclarationParentheses = true; policy.SpaceBetweenEmptyConstructorDeclarationParentheses = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -1190,7 +1190,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeDelegateDeclarationParentheses () public void TestBeforeDelegateDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeDelegateDeclarationParentheses = true; policy.SpaceBeforeDelegateDeclarationParentheses = true;
var result = GetResult (policy, @"delegate void Test();"); var result = GetResult (policy, @"delegate void Test();");
@ -1201,7 +1201,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeDelegateDeclarationParenthesesComplex () public void TestBeforeDelegateDeclarationParenthesesComplex ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeDelegateDeclarationParentheses = true; policy.SpaceBeforeDelegateDeclarationParentheses = true;
var result = GetResult (policy, "delegate void TestDelegate\t\t\t();"); var result = GetResult (policy, "delegate void TestDelegate\t\t\t();");
@ -1212,7 +1212,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeDelegateDeclarationParameterComma () public void TestBeforeDelegateDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeDelegateDeclarationParameterComma = true; policy.SpaceBeforeDelegateDeclarationParameterComma = true;
policy.SpaceAfterDelegateDeclarationParameterComma = false; policy.SpaceAfterDelegateDeclarationParameterComma = false;
@ -1232,7 +1232,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterDelegateDeclarationParameterComma () public void TestAfterDelegateDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeDelegateDeclarationParameterComma = false; policy.SpaceBeforeDelegateDeclarationParameterComma = false;
policy.SpaceAfterDelegateDeclarationParameterComma = true; policy.SpaceAfterDelegateDeclarationParameterComma = true;
@ -1252,7 +1252,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinDelegateDeclarationParentheses () public void TestWithinDelegateDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinDelegateDeclarationParentheses = true; policy.SpaceWithinDelegateDeclarationParentheses = true;
var result = GetResult (policy, @"delegate void Test (int a);"); var result = GetResult (policy, @"delegate void Test (int a);");
@ -1264,7 +1264,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBetweenEmptyDelegateDeclarationParentheses () public void TestBetweenEmptyDelegateDeclarationParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBetweenEmptyDelegateDeclarationParentheses = true; policy.SpaceBetweenEmptyDelegateDeclarationParentheses = true;
var result = GetResult (policy, @"delegate void Test();"); var result = GetResult (policy, @"delegate void Test();");
@ -1279,7 +1279,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeMethodCallParentheses () public void TestBeforeMethodCallParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodCallParentheses = true; policy.SpaceBeforeMethodCallParentheses = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1302,7 +1302,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeMethodCallParameterComma () public void TestBeforeMethodCallParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodCallParameterComma = true; policy.SpaceBeforeMethodCallParameterComma = true;
policy.SpaceAfterMethodCallParameterComma = false; policy.SpaceAfterMethodCallParameterComma = false;
@ -1327,7 +1327,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterMethodCallParameterComma () public void TestAfterMethodCallParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeMethodCallParameterComma = false; policy.SpaceBeforeMethodCallParameterComma = false;
policy.SpaceAfterMethodCallParameterComma = true; policy.SpaceAfterMethodCallParameterComma = true;
@ -1352,7 +1352,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinMethodCallParentheses () public void TestWithinMethodCallParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinMethodCallParentheses = true; policy.SpaceWithinMethodCallParentheses = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1370,7 +1370,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBetweenEmptyMethodCallParentheses () public void TestBetweenEmptyMethodCallParentheses ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBetweenEmptyMethodCallParentheses = true; policy.SpaceBetweenEmptyMethodCallParentheses = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1392,7 +1392,7 @@ return (Test)null;
public void TestBeforeIndexerDeclarationBracket () public void TestBeforeIndexerDeclarationBracket ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeIndexerDeclarationBracket = true; policy.SpaceBeforeIndexerDeclarationBracket = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1416,7 +1416,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeIndexerDeclarationParameterComma () public void TestBeforeIndexerDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeIndexerDeclarationParameterComma = true; policy.SpaceBeforeIndexerDeclarationParameterComma = true;
policy.SpaceAfterIndexerDeclarationParameterComma = false; policy.SpaceAfterIndexerDeclarationParameterComma = false;
@ -1437,7 +1437,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterIndexerDeclarationParameterComma () public void TestAfterIndexerDeclarationParameterComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAfterIndexerDeclarationParameterComma = true; policy.SpaceAfterIndexerDeclarationParameterComma = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1456,7 +1456,7 @@ return (Test)null;
[Test()] [Test()]
public void TestWithinIndexerDeclarationBracket () public void TestWithinIndexerDeclarationBracket ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceWithinIndexerDeclarationBracket = true; policy.SpaceWithinIndexerDeclarationBracket = true;
var result = GetResult (policy, @"class FooBar var result = GetResult (policy, @"class FooBar
@ -1479,7 +1479,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpacesWithinBrackets () public void TestSpacesWithinBrackets ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesWithinBrackets = true; policy.SpacesWithinBrackets = true;
policy.SpacesBeforeBrackets = false; policy.SpacesBeforeBrackets = false;
@ -1503,7 +1503,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpacesBeforeBrackets () public void TestSpacesBeforeBrackets ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpacesBeforeBrackets = true; policy.SpacesBeforeBrackets = true;
var result = GetResult (policy, @"class Test var result = GetResult (policy, @"class Test
@ -1527,7 +1527,7 @@ return (Test)null;
[Test()] [Test()]
public void TestBeforeBracketComma () public void TestBeforeBracketComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeBracketComma = true; policy.SpaceBeforeBracketComma = true;
policy.SpaceAfterBracketComma = false; policy.SpaceAfterBracketComma = false;
@ -1546,7 +1546,7 @@ return (Test)null;
[Test()] [Test()]
public void TestAfterBracketComma () public void TestAfterBracketComma ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceAfterBracketComma = true; policy.SpaceAfterBracketComma = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -1566,7 +1566,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpacesBeforeArrayDeclarationBrackets () public void TestSpacesBeforeArrayDeclarationBrackets ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceBeforeArrayDeclarationBrackets = true; policy.SpaceBeforeArrayDeclarationBrackets = true;
var result = GetResult (policy, @"class Test { var result = GetResult (policy, @"class Test {
@ -1586,7 +1586,7 @@ return (Test)null;
[Test()] [Test()]
public void TestRemoveWhitespacesBeforeSemicolon() public void TestRemoveWhitespacesBeforeSemicolon()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions(); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
var result = GetResult(policy, @"class Test { var result = GetResult(policy, @"class Test {
void TestMe () void TestMe ()
{ {
@ -1601,7 +1601,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpaceInNamedArgumentAfterDoubleColon() public void TestSpaceInNamedArgumentAfterDoubleColon()
{ {
var policy = new CSharpFormattingOptions(); var policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceInNamedArgumentAfterDoubleColon = true; policy.SpaceInNamedArgumentAfterDoubleColon = true;
var result = GetResult(policy, @"class Test { var result = GetResult(policy, @"class Test {
void TestMe () void TestMe ()
@ -1617,7 +1617,7 @@ return (Test)null;
[Test()] [Test()]
public void TestSpaceInNamedArgumentAfterDoubleColon2() public void TestSpaceInNamedArgumentAfterDoubleColon2()
{ {
var policy = new CSharpFormattingOptions(); var policy = FormattingOptionsFactory.CreateMono ();
policy.SpaceInNamedArgumentAfterDoubleColon = false; policy.SpaceInNamedArgumentAfterDoubleColon = false;
var result = GetResult(policy, @"class Test { var result = GetResult(policy, @"class Test {
void TestMe () void TestMe ()

144
ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestInvocationIndentation () public void TestInvocationIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, Test (policy,
@ -58,7 +58,7 @@ this.TestMethod ();
[Test()] [Test()]
public void TestIndentBlocks () public void TestIndentBlocks ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentBlocks = true; policy.IndentBlocks = true;
var adapter = Test (policy, var adapter = Test (policy,
@ -94,7 +94,7 @@ this.TestMethod ();
[Test()] [Test()]
public void TestIndentBlocksCase2 () public void TestIndentBlocksCase2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentBlocks = true; policy.IndentBlocks = true;
var adapter = Test (policy, var adapter = Test (policy,
@ -130,7 +130,7 @@ this.TestMethod ();
[Test()] [Test()]
public void TestBreakIndentation () public void TestBreakIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, Test (policy,
@ -151,7 +151,7 @@ this.TestMethod ();
[Test()] [Test()]
public void TestBreakSemicolon () public void TestBreakSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, Test (policy,
@"class Test @"class Test
@ -173,7 +173,7 @@ this.TestMethod ();
[Test()] [Test()]
public void TestCheckedIndentation () public void TestCheckedIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -195,7 +195,7 @@ checked {
[Test()] [Test()]
public void TestBaseIndentation () public void TestBaseIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -214,7 +214,7 @@ checked {
[Test()] [Test()]
public void TestUncheckedIndentation () public void TestUncheckedIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -236,7 +236,7 @@ unchecked {
[Test()] [Test()]
public void TestContinueIndentation () public void TestContinueIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -256,7 +256,7 @@ continue;
[Test()] [Test()]
public void TestContinueSemicolon () public void TestContinueSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {
Test TestMethod () Test TestMethod ()
@ -276,7 +276,7 @@ continue;
[Test()] [Test()]
public void TestEmptyStatementIndentation () public void TestEmptyStatementIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -295,7 +295,7 @@ continue;
[Test()] [Test()]
public void TestFixedStatementIndentation () public void TestFixedStatementIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -317,7 +317,7 @@ fixed (object* obj = &obj)
[Test()] [Test()]
public void TestFixedForcementAdd () public void TestFixedForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.FixedBraceForcement = BraceForcement.AddBraces; policy.FixedBraceForcement = BraceForcement.AddBraces;
@ -347,7 +347,7 @@ fixed (object* obj = &obj)
[Test()] [Test()]
public void TestForeachIndentation () public void TestForeachIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -370,7 +370,7 @@ foreach (var obj in col) {
[Test()] [Test()]
public void TestForIndentation () public void TestForIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -392,7 +392,7 @@ for (;;) {
[Test()] [Test()]
public void TestGotoIndentation () public void TestGotoIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -412,7 +412,7 @@ goto label;
[Test()] [Test()]
public void TestGotoSemicolon () public void TestGotoSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {
Test TestMethod () Test TestMethod ()
@ -433,7 +433,7 @@ goto label;
[Test()] [Test()]
public void TestReturnIndentation () public void TestReturnIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -453,7 +453,7 @@ goto label;
[Test()] [Test()]
public void TestReturnSemicolon () public void TestReturnSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {
Test TestMethod () Test TestMethod ()
@ -472,7 +472,7 @@ goto label;
[Test()] [Test()]
public void TestLockIndentation () public void TestLockIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -494,7 +494,7 @@ lock (this) {
[Test()] [Test()]
public void TestThrowIndentation () public void TestThrowIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -515,7 +515,7 @@ throw new NotSupportedException ();
[Test()] [Test()]
public void TestThrowSemicolon () public void TestThrowSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {
Test TestMethod () Test TestMethod ()
@ -535,7 +535,7 @@ throw new NotSupportedException ();
[Test()] [Test()]
public void TestUnsafeIndentation () public void TestUnsafeIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -558,7 +558,7 @@ unsafe {
[Test()] [Test()]
public void TestUsingIndentation () public void TestUsingIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -580,7 +580,7 @@ using (var o = new MyObj()) {
[Test()] [Test()]
public void TestUsingForcementAdd () public void TestUsingForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.UsingBraceForcement = BraceForcement.AddBraces; policy.UsingBraceForcement = BraceForcement.AddBraces;
@ -610,7 +610,7 @@ using (var o = new MyObj()) {
[Test()] [Test()]
public void TestUsingForcementDoNotChange () public void TestUsingForcementDoNotChange ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.UsingBraceForcement = BraceForcement.DoNotChange; policy.UsingBraceForcement = BraceForcement.DoNotChange;
@ -639,7 +639,7 @@ using (var o = new MyObj()) {
[Test()] [Test()]
public void TestUsingAlignment () public void TestUsingAlignment ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.AlignEmbeddedUsingStatements = true; policy.AlignEmbeddedUsingStatements = true;
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -673,7 +673,7 @@ using (var o = new MyObj()) {
[Test()] [Test()]
public void TestVariableDeclarationIndentation () public void TestVariableDeclarationIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -693,7 +693,7 @@ Test a;
[Test()] [Test()]
public void TestConstantVariableDeclarationIndentation () public void TestConstantVariableDeclarationIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -713,7 +713,7 @@ const int a = 5;
[Test()] [Test()]
public void TestYieldReturnIndentation () public void TestYieldReturnIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -733,7 +733,7 @@ yield return null;
[Test()] [Test()]
public void TestYieldReturnSemicolon () public void TestYieldReturnSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -753,7 +753,7 @@ yield return null;
[Test()] [Test()]
public void TestYieldBreakIndentation () public void TestYieldBreakIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -773,7 +773,7 @@ yield break;
[Test()] [Test()]
public void TestYieldBreakSemicolon () public void TestYieldBreakSemicolon ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -792,7 +792,7 @@ yield break;
[Test()] [Test()]
public void TestWhileIndentation () public void TestWhileIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -815,7 +815,7 @@ while (true)
[Test()] [Test()]
public void TestDoWhileIndentation () public void TestDoWhileIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test { Test (policy, @"class Test {
@ -837,7 +837,7 @@ do {
[Test()] [Test()]
public void TestForeachBracketPlacement () public void TestForeachBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test Test (policy, @"class Test
@ -860,7 +860,7 @@ do {
[Test()] [Test()]
public void TestForeachBracketPlacement2 () public void TestForeachBracketPlacement2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLineShifted2; policy.StatementBraceStyle = BraceStyle.NextLineShifted2;
Test (policy, @"class Test Test (policy, @"class Test
@ -885,7 +885,7 @@ do {
[Test()] [Test()]
public void TestForEachBraceForcementAdd () public void TestForEachBraceForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLine; policy.StatementBraceStyle = BraceStyle.NextLine;
policy.ForEachBraceForcement = BraceForcement.AddBraces; policy.ForEachBraceForcement = BraceForcement.AddBraces;
@ -917,7 +917,7 @@ do {
[Test()] [Test()]
public void TestForBraceForcementAdd () public void TestForBraceForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLine; policy.StatementBraceStyle = BraceStyle.NextLine;
policy.ForBraceForcement = BraceForcement.AddBraces; policy.ForBraceForcement = BraceForcement.AddBraces;
@ -951,7 +951,7 @@ do {
[Ignore("Crashes due to overlapping changes")] [Ignore("Crashes due to overlapping changes")]
public void TestForEachBraceForcementRemove () public void TestForEachBraceForcementRemove ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLine; policy.StatementBraceStyle = BraceStyle.NextLine;
policy.ForEachBraceForcement = BraceForcement.RemoveBraces; policy.ForEachBraceForcement = BraceForcement.RemoveBraces;
@ -988,7 +988,7 @@ do {
[Test()] [Test()]
public void TestIfBracketPlacement () public void TestIfBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1012,7 +1012,7 @@ do {
[Test()] [Test()]
public void TestAllowIfBlockInline () public void TestAllowIfBlockInline ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.AllowIfBlockInline = true; policy.AllowIfBlockInline = true;
@ -1082,7 +1082,7 @@ do {
[Test()] [Test()]
public void TestIfElseBracketPlacement () public void TestIfElseBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1108,7 +1108,7 @@ do {
[Ignore("Crashes due to overlapping changes")] [Ignore("Crashes due to overlapping changes")]
public void TestIfForcementRemove () public void TestIfForcementRemove ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLine; policy.StatementBraceStyle = BraceStyle.NextLine;
policy.IfElseBraceForcement = BraceForcement.RemoveBraces; policy.IfElseBraceForcement = BraceForcement.RemoveBraces;
@ -1146,7 +1146,7 @@ do {
[Test()] [Test()]
public void TestIfAlignment () public void TestIfAlignment ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.AlignEmbeddedIfStatements = true; policy.AlignEmbeddedIfStatements = true;
policy.ClassBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.EndOfLine;
@ -1180,7 +1180,7 @@ if (b) {
[Test()] [Test()]
public void TestIfForcementAdd () public void TestIfForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.IfElseBraceForcement = BraceForcement.AddBraces; policy.IfElseBraceForcement = BraceForcement.AddBraces;
@ -1207,7 +1207,7 @@ if (b) {
[Test()] [Test()]
public void TestIfForcementWithComment () public void TestIfForcementWithComment ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.IfElseBraceForcement = BraceForcement.AddBraces; policy.IfElseBraceForcement = BraceForcement.AddBraces;
@ -1234,7 +1234,7 @@ if (b) {
[Test()] [Test()]
public void TestIfElseForcementAdd () public void TestIfElseForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.IfElseBraceForcement = BraceForcement.AddBraces; policy.IfElseBraceForcement = BraceForcement.AddBraces;
@ -1265,7 +1265,7 @@ if (b) {
[Test()] [Test()]
public void TestIfElseIFForcementAdd () public void TestIfElseIFForcementAdd ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.IfElseBraceForcement = BraceForcement.AddBraces; policy.IfElseBraceForcement = BraceForcement.AddBraces;
@ -1296,7 +1296,7 @@ if (b) {
[Test()] [Test()]
public void TestElseOnNewLine () public void TestElseOnNewLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceElseOnNewLine = true; policy.PlaceElseOnNewLine = true;
Test (policy, @"class Test Test (policy, @"class Test
@ -1327,7 +1327,7 @@ if (b) {
[Test()] [Test()]
public void TestElseIfOnNewLine () public void TestElseIfOnNewLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceElseIfOnNewLine = true; policy.PlaceElseIfOnNewLine = true;
Test (policy, @"class Test Test (policy, @"class Test
@ -1358,7 +1358,7 @@ if (b) {
[Test()] [Test()]
public void TestElseOnNewLineOff () public void TestElseOnNewLineOff ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceElseOnNewLine = false; policy.PlaceElseOnNewLine = false;
Test (policy, @"class Test Test (policy, @"class Test
@ -1389,7 +1389,7 @@ if (b) {
[Test()] [Test()]
public void TestSimpleIfElseComment () public void TestSimpleIfElseComment ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
policy.PlaceElseIfOnNewLine = false; // for simple statements it must be new line. policy.PlaceElseIfOnNewLine = false; // for simple statements it must be new line.
@ -1417,7 +1417,7 @@ if (b) {
[Ignore("Crashes due to overlapping changes")] [Ignore("Crashes due to overlapping changes")]
public void TestWhileForcementRemove () public void TestWhileForcementRemove ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLine; policy.StatementBraceStyle = BraceStyle.NextLine;
policy.WhileBraceForcement = BraceForcement.RemoveBraces; policy.WhileBraceForcement = BraceForcement.RemoveBraces;
@ -1455,7 +1455,7 @@ if (b) {
[Test()] [Test()]
public void TestFixedBracketPlacement () public void TestFixedBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.NextLineShifted; policy.StatementBraceStyle = BraceStyle.NextLineShifted;
policy.FixedBraceForcement = BraceForcement.AddBraces; policy.FixedBraceForcement = BraceForcement.AddBraces;
@ -1485,7 +1485,7 @@ if (b) {
[Test()] [Test()]
public void TestForBracketPlacement () public void TestForBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
Test (policy, @"class Test Test (policy, @"class Test
@ -1509,7 +1509,7 @@ if (b) {
[Test()] [Test()]
public void TestCheckedBracketPlacement () public void TestCheckedBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
@ -1534,7 +1534,7 @@ if (b) {
[Test()] [Test()]
public void TestUncheckedBracketPlacement () public void TestUncheckedBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace; policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
@ -1559,7 +1559,7 @@ if (b) {
[Test()] [Test()]
public void TestLockBracketPlacement () public void TestLockBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1587,7 +1587,7 @@ if (b) {
[Test()] [Test()]
public void TestUnsafeBracketPlacement () public void TestUnsafeBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1615,7 +1615,7 @@ if (b) {
[Test()] [Test()]
public void TestUsingBracketPlacement () public void TestUsingBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1643,7 +1643,7 @@ if (b) {
[Test()] [Test()]
public void TestWhileBracketPlacement () public void TestWhileBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1671,7 +1671,7 @@ if (b) {
[Test()] [Test()]
public void TestDoWhileBracketPlacement () public void TestDoWhileBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1699,7 +1699,7 @@ if (b) {
[Test()] [Test()]
public void TestSwitchFormatting1 () public void TestSwitchFormatting1 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentSwitchBody = true; policy.IndentSwitchBody = true;
policy.IndentCaseBody = true; policy.IndentCaseBody = true;
@ -1732,7 +1732,7 @@ if (b) {
[Test()] [Test()]
public void TestSwitchFormatting2 () public void TestSwitchFormatting2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentSwitchBody = false; policy.IndentSwitchBody = false;
policy.IndentCaseBody = false; policy.IndentCaseBody = false;
@ -1766,7 +1766,7 @@ if (b) {
[Test()] [Test()]
public void TestSwitchIndentBreak () public void TestSwitchIndentBreak ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentSwitchBody = true; policy.IndentSwitchBody = true;
policy.IndentBreakStatements = true; policy.IndentBreakStatements = true;
@ -1840,7 +1840,7 @@ if (b) {
[Test()] [Test()]
public void TestTryCatchBracketPlacement () public void TestTryCatchBracketPlacement ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.StatementBraceStyle = BraceStyle.EndOfLine; policy.StatementBraceStyle = BraceStyle.EndOfLine;
@ -1867,7 +1867,7 @@ if (b) {
[Test()] [Test()]
public void TestPlaceCatchOnNewLine () public void TestPlaceCatchOnNewLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceCatchOnNewLine = true; policy.PlaceCatchOnNewLine = true;
@ -1899,7 +1899,7 @@ if (b) {
[Test()] [Test()]
public void TestPlaceFinallyOnNewLine () public void TestPlaceFinallyOnNewLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceFinallyOnNewLine = true; policy.PlaceFinallyOnNewLine = true;
Test (policy, @"class Test Test (policy, @"class Test
@ -1930,7 +1930,7 @@ if (b) {
[Test()] [Test()]
public void TestPlaceWhileOnNewLine () public void TestPlaceWhileOnNewLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PlaceWhileOnNewLine = true; policy.PlaceWhileOnNewLine = true;
@ -1958,7 +1958,7 @@ if (b) {
[Test()] [Test()]
public void TestBlockStatementWithComments () public void TestBlockStatementWithComments ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {
@ -1986,7 +1986,7 @@ if (b) {
[Test()] [Test()]
public void TestBlockStatementWithPreProcessorDirective () public void TestBlockStatementWithPreProcessorDirective ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, @"class Test Test (policy, @"class Test
{ {

42
ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestClassIndentation () public void TestClassIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy, Test (policy,
@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestAttributeIndentation () public void TestAttributeIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy, Test (policy,
@ -63,7 +63,7 @@ class Test {}");
[Test()] [Test()]
public void TestClassIndentationInNamespaces () public void TestClassIndentationInNamespaces ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
@ -77,7 +77,7 @@ class Test {}");
[Test()] [Test()]
public void TestNoIndentationInNamespaces () public void TestNoIndentationInNamespaces ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.IndentNamespaceBody = false; policy.IndentNamespaceBody = false;
@ -92,7 +92,7 @@ class Test {}
[Test()] [Test()]
public void TestClassIndentationInNamespacesCase2 () public void TestClassIndentationInNamespacesCase2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.NamespaceBraceStyle = BraceStyle.NextLine; policy.NamespaceBraceStyle = BraceStyle.NextLine;
policy.ClassBraceStyle = BraceStyle.NextLine; policy.ClassBraceStyle = BraceStyle.NextLine;
policy.ConstructorBraceStyle = BraceStyle.NextLine; policy.ConstructorBraceStyle = BraceStyle.NextLine;
@ -122,7 +122,7 @@ namespace MonoDevelop.CSharp.Formatting
[Test()] [Test()]
public void TestIndentClassBody () public void TestIndentClassBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentClassBody = true; policy.IndentClassBody = true;
Test (policy, Test (policy,
@"class Test @"class Test
@ -148,7 +148,7 @@ Test a;
[Test()] [Test()]
public void TestIndentInterfaceBody () public void TestIndentInterfaceBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentInterfaceBody = true; policy.IndentInterfaceBody = true;
Test (policy, Test (policy,
@ -173,7 +173,7 @@ Test Foo ();
[Test()] [Test()]
public void TestIndentStructBody () public void TestIndentStructBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentStructBody = true; policy.IndentStructBody = true;
Test (policy, Test (policy,
@ -198,7 +198,7 @@ Test Foo ();
[Test()] [Test()]
public void TestIndentEnumBody () public void TestIndentEnumBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentEnumBody = true; policy.IndentEnumBody = true;
Test (policy, Test (policy,
@ -223,7 +223,7 @@ A
[Test()] [Test()]
public void TestIndentMethodBody () public void TestIndentMethodBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentMethodBody = true; policy.IndentMethodBody = true;
Test (policy, Test (policy,
@ -266,7 +266,7 @@ A
[Test()] [Test()]
public void TestIndentMethodBodyOperatorCase () public void TestIndentMethodBodyOperatorCase ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentMethodBody = true; policy.IndentMethodBody = true;
var adapter = Test (policy, var adapter = Test (policy,
@ -300,7 +300,7 @@ A
[Test()] [Test()]
public void TestIndentPropertyBody () public void TestIndentPropertyBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentPropertyBody = true; policy.IndentPropertyBody = true;
var adapter = Test (policy, var adapter = Test (policy,
@ -333,7 +333,7 @@ set;
[Test()] [Test()]
public void TestIndentPropertyOneLine () public void TestIndentPropertyOneLine ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true; policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true; policy.AllowPropertySetBlockInline = true;
@ -352,7 +352,7 @@ set;
[Test()] [Test()]
public void TestIndentPropertyOneLineCase2 () public void TestIndentPropertyOneLineCase2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true; policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true; policy.AllowPropertySetBlockInline = true;
@ -371,7 +371,7 @@ set;
[Test()] [Test()]
public void TestIndentPropertyBodyIndexerCase () public void TestIndentPropertyBodyIndexerCase ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentPropertyBody = true; policy.IndentPropertyBody = true;
var adapter = Test (policy, var adapter = Test (policy,
@ -415,7 +415,7 @@ set {
[Test()] [Test()]
public void TestPropertyAlignment () public void TestPropertyAlignment ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
var adapter = Test (policy, var adapter = Test (policy,
@"class Test @"class Test
@ -448,7 +448,7 @@ set {
[Test()] [Test()]
public void TestIndentNamespaceBody () public void TestIndentNamespaceBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.IndentNamespaceBody = true; policy.IndentNamespaceBody = true;
@ -471,7 +471,7 @@ class FooBar {}
[Test()] [Test()]
public void TestMethodIndentation () public void TestMethodIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.MethodBraceStyle = BraceStyle.DoNotChange; policy.MethodBraceStyle = BraceStyle.DoNotChange;
Test (policy, Test (policy,
@ -488,7 +488,7 @@ MyType TestMethod () {}
[Test()] [Test()]
public void TestPropertyIndentation () public void TestPropertyIndentation ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange; policy.PropertyBraceStyle = BraceStyle.DoNotChange;
Test (policy, Test (policy,
@ -504,7 +504,7 @@ MyType TestMethod () {}
[Test()] [Test()]
public void TestPropertyIndentationCase2 () public void TestPropertyIndentationCase2 ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
Test (policy, Test (policy,
@"class Test @"class Test
@ -527,7 +527,7 @@ set;
[Test()] [Test()]
public void TestIndentEventBody () public void TestIndentEventBody ()
{ {
CSharpFormattingOptions policy = new CSharpFormattingOptions (); CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.IndentEventBody = true; policy.IndentEventBody = true;
var adapter = Test (policy, var adapter = Test (policy,

6
ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestInitializerWrapAlways() public void TestInitializerWrapAlways()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
ArrayInitializerWrapping = Wrapping.WrapAlways ArrayInitializerWrapping = Wrapping.WrapAlways
}; };
@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestInitializerDoNotWrap() public void TestInitializerDoNotWrap()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
ArrayInitializerWrapping = Wrapping.DoNotWrap ArrayInitializerWrapping = Wrapping.DoNotWrap
}; };
@ -91,7 +91,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
[Test()] [Test()]
public void TestInitializerBraceStyle() public void TestInitializerBraceStyle()
{ {
var policy = new CSharpFormattingOptions() { var policy = FormattingOptionsFactory.CreateMonoOptions () {
ArrayInitializerWrapping = Wrapping.WrapAlways, ArrayInitializerWrapping = Wrapping.WrapAlways,
ArrayInitializerBraceStyle = BraceStyle.NextLine ArrayInitializerBraceStyle = BraceStyle.NextLine
}; };

2
ICSharpCode.NRefactory.VB/Ast/Statements/Statement.cs

@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
//// if (IsNull) //// if (IsNull)
//// return "Null"; //// return "Null";
//// StringWriter w = new StringWriter(); //// 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, " "); //// string text = w.ToString().TrimEnd().Replace("\t", "").Replace(w.NewLine, " ");
//// if (text.Length > 100) //// if (text.Length > 100)
//// return text.Substring(0, 97) + "..."; //// return text.Substring(0, 97) + "...";

Loading…
Cancel
Save