Browse Source

Merge remote-tracking branch 'upstream/master' into mansheng

newNRvisualizers
Mansheng Yang 14 years ago
parent
commit
aa59c76669
  1. 2
      ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs
  2. 3
      ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj
  3. 77
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  4. 2
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs
  5. 93
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractFieldAction.cs
  6. 2
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/UseExplicitTypeAction.cs
  7. 43
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/DefaultRules.cs
  8. 2
      ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs
  9. 2
      ICSharpCode.NRefactory.Demo/CSDemo.cs
  10. 149
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtractFieldTests.cs
  11. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs
  12. 106
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InconsistentNamingTests.cs
  13. 20
      ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs
  14. 34
      ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs
  15. 3
      ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj
  16. 1
      ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs

2
ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs

@ -1822,7 +1822,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (methodCallArgumentWrapping == Wrapping.DoNotWrap) { if (methodCallArgumentWrapping == Wrapping.DoNotWrap) {
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses); ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
} else { } else {
bool sameLine = rParToken.GetPrevNode().StartLocation.Line == rParToken.StartLocation.Line; bool sameLine = rParToken.GetPrevNode().EndLocation.Line == rParToken.StartLocation.Line;
if (sameLine) { if (sameLine) {
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses); ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
} else { } else {

3
ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{53DCA265-3C3C-42F9-B647-F72BA678122B}</ProjectGuid> <ProjectGuid>{53DCA265-3C3C-42F9-B647-F72BA678122B}</ProjectGuid>
@ -387,6 +387,7 @@
<Compile Include="Refactoring\CodeActions\ImplementInterfaceAction.cs" /> <Compile Include="Refactoring\CodeActions\ImplementInterfaceAction.cs" />
<Compile Include="Refactoring\CodeActions\ImplementInterfaceExplicitAction.cs" /> <Compile Include="Refactoring\CodeActions\ImplementInterfaceExplicitAction.cs" />
<Compile Include="Refactoring\CodeActions\ImplementAbstractMembersAction.cs" /> <Compile Include="Refactoring\CodeActions\ImplementAbstractMembersAction.cs" />
<Compile Include="Refactoring\CodeActions\ExtractFieldAction.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">

77
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -177,7 +177,7 @@ namespace ICSharpCode.NRefactory.CSharp
} }
return result; return result;
} }
AstType ConvertToType (Mono.CSharp.Expression typeName) AstType ConvertToType (Mono.CSharp.Expression typeName)
{ {
if (typeName == null) // may happen in typeof(Generic<,,,,>) if (typeName == null) // may happen in typeof(Generic<,,,,>)
@ -190,7 +190,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (typeName is Mono.CSharp.QualifiedAliasMember) { if (typeName is Mono.CSharp.QualifiedAliasMember) {
var qam = (Mono.CSharp.QualifiedAliasMember)typeName; var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
var memberType = new MemberType (); var memberType = new MemberType ();
memberType.Target = new SimpleType (qam.alias, Convert (qam.Location)); memberType.Target = new SimpleType (qam.alias, Convert (qam.Location));
memberType.IsDoubleColon = true; memberType.IsDoubleColon = true;
memberType.MemberName = qam.Name; memberType.MemberName = qam.Name;
@ -267,7 +267,7 @@ namespace ICSharpCode.NRefactory.CSharp
int pos = 0; int pos = 0;
if (loc != null) if (loc != null)
result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.LPar); result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.LPar);
if (attr.PositionalArguments != null) { if (attr.PositionalArguments != null) {
foreach (var arg in attr.PositionalArguments) { foreach (var arg in attr.PositionalArguments) {
var na = arg as NamedArgument; var na = arg as NamedArgument;
@ -289,7 +289,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Comma); result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Comma);
} }
} }
if (attr.NamedArguments != null) { if (attr.NamedArguments != null) {
foreach (NamedArgument na in attr.NamedArguments) { foreach (NamedArgument na in attr.NamedArguments) {
var newArg = new NamedExpression (); var newArg = new NamedExpression ();
newArg.AddChild (Identifier.Create (na.Name, Convert (na.Location)), Roles.Identifier); newArg.AddChild (Identifier.Create (na.Name, Convert (na.Location)), Roles.Identifier);
@ -387,13 +387,13 @@ namespace ICSharpCode.NRefactory.CSharp
} }
// public override void Visit (UsingsBag.Namespace nspace) // public override void Visit (UsingsBag.Namespace nspace)
// { // {
// //
// //
// VisitNamespaceUsings (nspace); // VisitNamespaceUsings (nspace);
// VisitNamespaceBody (nspace); // VisitNamespaceBody (nspace);
// //
// } // }
// //
void ConvertNamespaceName (MemberName memberName, NamespaceDeclaration namespaceDecl) void ConvertNamespaceName (MemberName memberName, NamespaceDeclaration namespaceDecl)
{ {
AstNode insertPos = null; AstNode insertPos = null;
@ -439,7 +439,7 @@ namespace ICSharpCode.NRefactory.CSharp
ud.AddChild (new CSharpTokenNode (Convert (loc [1])), Roles.Semicolon); ud.AddChild (new CSharpTokenNode (Convert (loc [1])), Roles.Semicolon);
AddToNamespace (ud); AddToNamespace (ud);
} }
public override void Visit (UsingExternAlias uea) public override void Visit (UsingExternAlias uea)
{ {
var ud = new ExternAliasDeclaration (); var ud = new ExternAliasDeclaration ();
@ -755,7 +755,7 @@ namespace ICSharpCode.NRefactory.CSharp
var bracketLocations = LocationsBag.GetLocations (f.Initializer); var bracketLocations = LocationsBag.GetLocations (f.Initializer);
if (bracketLocations != null && bracketLocations.Count > 1) if (bracketLocations != null && bracketLocations.Count > 1)
variable.AddChild (new CSharpTokenNode (Convert (bracketLocations [0])), Roles.LBracket); variable.AddChild (new CSharpTokenNode (Convert (bracketLocations [0])), Roles.LBracket);
variable.AddChild ((Expression)f.Initializer.Accept (this), Roles.Expression); variable.AddChild ((Expression)f.Initializer.Accept (this), Roles.Expression);
if (bracketLocations != null && bracketLocations.Count > 1) if (bracketLocations != null && bracketLocations.Count > 1)
variable.AddChild (new CSharpTokenNode (Convert (bracketLocations [0])), Roles.RBracket); variable.AddChild (new CSharpTokenNode (Convert (bracketLocations [0])), Roles.RBracket);
@ -1062,7 +1062,7 @@ namespace ICSharpCode.NRefactory.CSharp
modifierTable [Mono.CSharp.Modifiers.ASYNC] = ICSharpCode.NRefactory.CSharp.Modifiers.Async; modifierTable [Mono.CSharp.Modifiers.ASYNC] = ICSharpCode.NRefactory.CSharp.Modifiers.Async;
keywordTable = new string[255]; keywordTable = new string[255];
for (int i = 0; i< keywordTable.Length; i++) for (int i = 0; i< keywordTable.Length; i++)
keywordTable [i] = "unknown"; keywordTable [i] = "unknown";
keywordTable [(int)BuiltinTypeSpec.Type.Other] = "void"; keywordTable [(int)BuiltinTypeSpec.Type.Other] = "void";
@ -2118,7 +2118,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (memberAccess.DotLocation)), Roles.Dot); result.AddChild (new CSharpTokenNode (Convert (memberAccess.DotLocation)), Roles.Dot);
} }
} }
result.AddChild (Identifier.Create (memberAccess.Name, Convert (memberAccess.Location)), Roles.Identifier); result.AddChild (Identifier.Create (memberAccess.Name, Convert (memberAccess.Location)), Roles.Identifier);
AddTypeArguments (result, memberAccess); AddTypeArguments (result, memberAccess);
@ -2137,7 +2137,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (Constant constant) public override object Visit (Constant constant)
{ {
if (constant.GetValue () == null) if (constant.GetValue () == null)
return new NullReferenceExpression (Convert (constant.Location)); return new NullReferenceExpression (Convert (constant.Location));
string literalValue; string literalValue;
if (constant is ILiteralConstant) { if (constant is ILiteralConstant) {
@ -2699,7 +2699,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (par == null) if (par == null)
continue; continue;
var parLocation = LocationsBag.GetLocations (par); var parLocation = LocationsBag.GetLocations (par);
if (parLocation == null) { if (parLocation == null) {
if (par.Expr != null) if (par.Expr != null)
result.AddChild ((Expression)par.Expr.Accept (this), Roles.Expression); result.AddChild ((Expression)par.Expr.Accept (this), Roles.Expression);
@ -2718,16 +2718,16 @@ namespace ICSharpCode.NRefactory.CSharp
return result; return result;
} }
ArrayInitializerExpression ConvertCollectionOrObjectInitializers(CollectionOrObjectInitializers minit) ArrayInitializerExpression ConvertCollectionOrObjectInitializers(CollectionOrObjectInitializers minit)
{ {
if (minit == null) if (minit == null)
return null; return null;
var init = new ArrayInitializerExpression(); var init = new ArrayInitializerExpression();
AddConvertCollectionOrObjectInitializers(init, minit); AddConvertCollectionOrObjectInitializers(init, minit);
return init; return init;
} }
void AddConvertCollectionOrObjectInitializers(Expression init, CollectionOrObjectInitializers minit) void AddConvertCollectionOrObjectInitializers(Expression init, CollectionOrObjectInitializers minit)
{ {
var initLoc = LocationsBag.GetLocations(minit); var initLoc = LocationsBag.GetLocations(minit);
var commaLoc = LocationsBag.GetLocations(minit.Initializers); var commaLoc = LocationsBag.GetLocations(minit.Initializers);
@ -2738,12 +2738,12 @@ namespace ICSharpCode.NRefactory.CSharp
var collectionInit = expr as CollectionElementInitializer; var collectionInit = expr as CollectionElementInitializer;
if (collectionInit != null) { if (collectionInit != null) {
AstNode parent; AstNode parent;
// For ease of use purposes in the resolver the ast representation // For ease of use purposes in the resolver the ast representation
// of { a, b, c } is { {a}, {b}, {c} } - but the generated ArrayInitializerExpression // of { a, b, c } is { {a}, {b}, {c} } - but the generated ArrayInitializerExpression
// can be identified by expr.IsSingleElement. // can be identified by expr.IsSingleElement.
if (!collectionInit.IsSingle) { if (!collectionInit.IsSingle) {
parent = new ArrayInitializerExpression(); parent = new ArrayInitializerExpression();
parent.AddChild(new CSharpTokenNode(Convert(collectionInit.Location)), Roles.LBrace); parent.AddChild(new CSharpTokenNode(Convert(collectionInit.Location)), Roles.LBrace);
} else { } else {
parent = ArrayInitializerExpression.CreateSingleElementInitializer (); parent = ArrayInitializerExpression.CreateSingleElementInitializer ();
} }
@ -2832,7 +2832,7 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Location)), ArrayCreateExpression.NewKeywordRole); result.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Location)), ArrayCreateExpression.NewKeywordRole);
if (arrayCreationExpression.TypeExpression != null) if (arrayCreationExpression.TypeExpression != null)
result.AddChild (ConvertToType (arrayCreationExpression.TypeExpression), Roles.Type); result.AddChild (ConvertToType (arrayCreationExpression.TypeExpression), Roles.Type);
var next = arrayCreationExpression.Rank; var next = arrayCreationExpression.Rank;
if (arrayCreationExpression.Arguments != null) { if (arrayCreationExpression.Arguments != null) {
// skip first array rank. // skip first array rank.
@ -3518,8 +3518,8 @@ namespace ICSharpCode.NRefactory.CSharp
var start = new TextLocation (comment.Line, comment.Col); var start = new TextLocation (comment.Line, comment.Col);
var end = new TextLocation (comment.EndLine, comment.EndCol); var end = new TextLocation (comment.EndLine, comment.EndCol);
newLeaf = new Comment (type, start, end) { newLeaf = new Comment (type, start, end) {
StartsLine = comment.StartsLine, StartsLine = comment.StartsLine,
Content = isMultilineDocumentationComment ? comment.Content.Substring(1) : comment.Content Content = isMultilineDocumentationComment ? comment.Content.Substring(1) : comment.Content
}; };
} else { } else {
var directive = special as SpecialsBag.PreProcessorDirective; var directive = special as SpecialsBag.PreProcessorDirective;
@ -3598,6 +3598,7 @@ namespace ICSharpCode.NRefactory.CSharp
} }
ErrorReportPrinter errorReportPrinter = new ErrorReportPrinter (null); ErrorReportPrinter errorReportPrinter = new ErrorReportPrinter (null);
[Obsolete("Use the Errors/Warnings/ErrorsAndWarnings properties instead")]
public ErrorReportPrinter ErrorPrinter { public ErrorReportPrinter ErrorPrinter {
get { get {
return errorReportPrinter; return errorReportPrinter;
@ -3616,6 +3617,22 @@ namespace ICSharpCode.NRefactory.CSharp
} }
} }
public IEnumerable<Error> Errors {
get {
return errorReportPrinter.Errors.Where(e => e.ErrorType == ErrorType.Error);
}
}
public IEnumerable<Error> Warnings {
get {
return errorReportPrinter.Errors.Where(e => e.ErrorType == ErrorType.Warning);
}
}
public IEnumerable<Error> ErrorsAndWarnings {
get { return errorReportPrinter.Errors; }
}
public CompilationUnit Parse (ITextSource textSource, string fileName, int lineModifier = 0) public CompilationUnit Parse (ITextSource textSource, string fileName, int lineModifier = 0)
{ {
return Parse (textSource.CreateReader (), fileName, lineModifier); return Parse (textSource.CreateReader (), fileName, lineModifier);
@ -3689,12 +3706,12 @@ namespace ICSharpCode.NRefactory.CSharp
var module = new ModuleContainer (ctx); var module = new ModuleContainer (ctx);
var parser = Driver.Parse (reader, file, module, lineModifier); var parser = Driver.Parse (reader, file, module, lineModifier);
var top = new CompilerCompilationUnit () { var top = new CompilerCompilationUnit () {
ModuleCompiled = module, ModuleCompiled = module,
LocationsBag = parser.LocationsBag, LocationsBag = parser.LocationsBag,
SpecialsBag = parser.Lexer.sbag SpecialsBag = parser.Lexer.sbag
}; };
var unit = Parse (top, fileName, lineModifier); var unit = Parse (top, fileName, lineModifier);
unit.Errors.AddRange (errorReportPrinter.Errors); unit.Errors.AddRange (errorReportPrinter.Errors);
CompilerCallableEntryPoint.Reset (); CompilerCallableEntryPoint.Reset ();
return unit; return unit;

2
ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs

@ -63,6 +63,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
ResolveResult targetResolveResult = null; ResolveResult targetResolveResult = null;
if (identifier is MemberReferenceExpression) { if (identifier is MemberReferenceExpression) {
targetResolveResult = context.Resolve(((MemberReferenceExpression)identifier).Target); targetResolveResult = context.Resolve(((MemberReferenceExpression)identifier).Target);
if (targetResolveResult.Type.GetDefinition() == null || targetResolveResult.Type.GetDefinition().Region.IsEmpty)
yield break;
createInOtherType = !state.CurrentTypeDefinition.Equals(targetResolveResult.Type.GetDefinition()); createInOtherType = !state.CurrentTypeDefinition.Equals(targetResolveResult.Type.GetDefinition());
} }

93
ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractFieldAction.cs

@ -0,0 +1,93 @@
//
// ExtractFieldAction.cs
//
// Author:
// Nieve <>
//
// Copyright (c) 2012 Nieve
//
// 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;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory.PatternMatching;
using Mono.CSharp;
namespace ICSharpCode.NRefactory.CSharp.Refactoring
{
[ContextAction("Extract field", Description = "Extracts a field from a local variable declaration.")]
public class ExtractFieldAction : ICodeActionProvider
{
public IEnumerable<CodeAction> GetActions(RefactoringContext context)
{
//TODO: implement variable assignment & ctor param
var varInit = context.GetNode<VariableInitializer>();
if (varInit != null) {
AstType type = varInit.GetPrevNode() as AstType;
if (type == null) yield break;
if (varInit.Parent is FieldDeclaration) yield break;
if (CannotExtractField(varInit)) yield break;
yield return new CodeAction("Extract field", s=>{
var name = varInit.Name;
FieldDeclaration field = new FieldDeclaration(){
ReturnType = type.Clone(),
Variables = { new VariableInitializer(name) }
};
AstNode nodeToRemove = RemoveDeclaration(varInit) ? varInit.Parent : type;
s.Remove(nodeToRemove, true);
s.InsertWithCursor(context.TranslateString("Extract field"),Script.InsertPosition.Before,field);
s.FormatText(varInit.Parent);
});
}
var idntf = context.GetNode<Identifier>();
if (idntf == null) yield break;
var paramDec = idntf.Parent as ParameterDeclaration;
if (paramDec != null) {
var ctor = paramDec.Parent as ConstructorDeclaration;
if (ctor == null) yield break;
MemberReferenceExpression thisField = new MemberReferenceExpression(new ThisReferenceExpression(), idntf.Name, new AstType[]{});
var assign = new AssignmentExpression(thisField, AssignmentOperatorType.Assign, new IdentifierExpression(idntf.Name));
var statement = new ExpressionStatement(assign);
var type = (idntf.GetPrevNode() as AstType).Clone();
FieldDeclaration field = new FieldDeclaration(){
ReturnType = type.Clone(),
Variables = { new VariableInitializer(idntf.Name) }
};
yield return new CodeAction("Extract field", s=>{
s.InsertWithCursor(context.TranslateString("Extract field"),Script.InsertPosition.Before,field);
s.AddTo(ctor.Body, statement);
});
}
}
static bool RemoveDeclaration (VariableInitializer varInit){
var result = varInit.Parent as VariableDeclarationStatement;
return result.Variables.First ().Initializer.IsNull;
}
static bool CannotExtractField (VariableInitializer varInit)
{
var result = varInit.Parent as VariableDeclarationStatement;
return result == null || result.Variables.Count != 1;
}
}
}

2
ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/UseExplicitTypeAction.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
if (!(!type.Equals(SpecialType.NullType) && !type.Equals(SpecialType.UnknownType))) { if (!(!type.Equals(SpecialType.NullType) && !type.Equals(SpecialType.UnknownType))) {
yield break; yield break;
} }
yield return new CodeAction (context.TranslateString("Use expcicit type"), script => { yield return new CodeAction (context.TranslateString("Use explicit type"), script => {
if (varDecl != null) { if (varDecl != null) {
script.Replace (varDecl.Type, context.CreateShortType (type)); script.Replace (varDecl.Type, context.CreateShortType (type));
} else { } else {

43
ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/DefaultRules.cs

@ -39,24 +39,28 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
yield return new NamingRule(AffectedEntity.Class | AffectedEntity.Struct | AffectedEntity.Enum | AffectedEntity.Delegate) { yield return new NamingRule(AffectedEntity.Class | AffectedEntity.Struct | AffectedEntity.Enum | AffectedEntity.Delegate) {
Name = "Types", Name = "Types",
VisibilityMask = Modifiers.Public,
NamingStyle = NamingStyle.PascalCase NamingStyle = NamingStyle.PascalCase
}; };
yield return new NamingRule(AffectedEntity.Interface) { yield return new NamingRule(AffectedEntity.Interface) {
Name = "Interfaces", Name = "Interfaces",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public,
RequiredPrefixes = new [] { "I" } RequiredPrefixes = new [] { "I" }
}; };
yield return new NamingRule(AffectedEntity.CustomAttributes) { yield return new NamingRule(AffectedEntity.CustomAttributes) {
Name = "Attributes", Name = "Attributes",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public,
RequiredSuffixes = new [] { "Attribute" } RequiredSuffixes = new [] { "Attribute" }
}; };
yield return new NamingRule(AffectedEntity.CustomEventArgs) { yield return new NamingRule(AffectedEntity.CustomEventArgs) {
Name = "Event Arguments", Name = "Event Arguments",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public,
RequiredSuffixes = new [] { "EventArgs" } RequiredSuffixes = new [] { "EventArgs" }
}; };
@ -68,66 +72,45 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
yield return new NamingRule(AffectedEntity.Methods) { yield return new NamingRule(AffectedEntity.Methods) {
Name = "Methods", Name = "Methods",
VisibilityMask = Modifiers.Public | Modifiers.Protected,
NamingStyle = NamingStyle.PascalCase NamingStyle = NamingStyle.PascalCase
}; };
yield return new NamingRule(AffectedEntity.ReadonlyField) { yield return new NamingRule(AffectedEntity.ReadonlyField) {
Name = "Static Readonly Fields", Name = "Static Readonly Fields",
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal, VisibilityMask = Modifiers.Public | Modifiers.Protected,
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
IncludeInstanceMembers = false IncludeInstanceMembers = false
}; };
yield return new NamingRule(AffectedEntity.Field) { yield return new NamingRule(AffectedEntity.Field) {
Name = "Fields (Non Private)", Name = "Fields",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal VisibilityMask = Modifiers.Public | Modifiers.Protected
}; };
yield return new NamingRule(AffectedEntity.ReadonlyField) { yield return new NamingRule(AffectedEntity.ReadonlyField) {
Name = "ReadOnly Fields (Non Private)", Name = "ReadOnly Fields",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal, VisibilityMask = Modifiers.Public | Modifiers.Protected,
IncludeStaticEntities = false
};
yield return new NamingRule(AffectedEntity.Field | AffectedEntity.ReadonlyField) {
Name = "Fields (Private)",
NamingStyle = NamingStyle.CamelCase,
AllowedPrefixes = new [] { "_", "m_" },
VisibilityMask = Modifiers.Private,
IncludeStaticEntities = false
};
yield return new NamingRule(AffectedEntity.Field) {
Name = "Static Fields (Private)",
NamingStyle = NamingStyle.CamelCase,
VisibilityMask = Modifiers.Private,
IncludeStaticEntities = true,
IncludeInstanceMembers = false
};
yield return new NamingRule(AffectedEntity.ReadonlyField) {
Name = "ReadOnly Fields (Private)",
NamingStyle = NamingStyle.CamelCase,
VisibilityMask = Modifiers.Private,
AllowedPrefixes = new [] { "_", "m_" },
IncludeStaticEntities = false IncludeStaticEntities = false
}; };
yield return new NamingRule(AffectedEntity.ConstantField) { yield return new NamingRule(AffectedEntity.ConstantField) {
Name = "Constant Fields", Name = "Constant Fields",
NamingStyle = NamingStyle.PascalCase, NamingStyle = NamingStyle.PascalCase,
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal | Modifiers.Private VisibilityMask = Modifiers.Public | Modifiers.Protected
}; };
yield return new NamingRule(AffectedEntity.Property) { yield return new NamingRule(AffectedEntity.Property) {
Name = "Properties", Name = "Properties",
VisibilityMask = Modifiers.Public | Modifiers.Protected,
NamingStyle = NamingStyle.PascalCase NamingStyle = NamingStyle.PascalCase
}; };
yield return new NamingRule(AffectedEntity.Event) { yield return new NamingRule(AffectedEntity.Event) {
Name = "Events", Name = "Events",
VisibilityMask = Modifiers.Public | Modifiers.Protected,
NamingStyle = NamingStyle.PascalCase NamingStyle = NamingStyle.PascalCase
}; };

2
ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs

@ -180,7 +180,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck
this.CompilationUnit = p.Parse(Content.CreateReader(), fileName); this.CompilationUnit = p.Parse(Content.CreateReader(), fileName);
if (p.HasErrors) { if (p.HasErrors) {
Console.WriteLine("Error parsing " + fileName + ":"); Console.WriteLine("Error parsing " + fileName + ":");
foreach (var error in p.ErrorPrinter.Errors) { foreach (var error in p.ErrorsAndWarnings) {
Console.WriteLine(" " + error.Region + " " + error.Message); Console.WriteLine(" " + error.Region + " " + error.Message);
} }
} }

2
ICSharpCode.NRefactory.Demo/CSDemo.cs

@ -94,7 +94,7 @@ namespace ICSharpCode.NRefactory.Demo
b.Append(node.GetType().Name); b.Append(node.GetType().Name);
bool hasProperties = false; bool hasProperties = false;
foreach (PropertyInfo p in node.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { foreach (PropertyInfo p in node.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
if (p.Name == "NodeType" || p.Name == "IsNull") if (p.Name == "NodeType" || p.Name == "IsNull" || p.Name == "IsFrozen" || p.Name == "HasChildren")
continue; continue;
if (p.PropertyType == typeof(string) || p.PropertyType.IsEnum || p.PropertyType == typeof(bool)) { if (p.PropertyType == typeof(string) || p.PropertyType.IsEnum || p.PropertyType == typeof(bool)) {
if (!hasProperties) { if (!hasProperties) {

149
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtractFieldTests.cs

@ -0,0 +1,149 @@
//
// CreateFieldTests.cs
//
// Author:
// Nieve Goor
//
// 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;
using NUnit.Framework;
using ICSharpCode.NRefactory.CSharp.Refactoring;
namespace ICSharpCode.NRefactory.CSharp.CodeActions
{
[TestFixture]
public class ExtractFieldTests : ContextActionTestBase
{
[Test]
public void TestWrongContext1 ()
{
TestWrongContext<ExtractFieldAction> (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" $foo = 2;" + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
}
[Test]
public void TestWrongContext2 ()
{
TestWrongContext<ExtractFieldAction> (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" int foo;" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" $foo = 2;" + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
}
[Test]
public void TestLocalInitializer()
{
string result = RunContextAction (
new ExtractFieldAction (),
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" int $foo = 5;" + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
Console.WriteLine (result);
Assert.AreEqual (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" int foo;" + Environment.NewLine +
"" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" foo = 5;" + Environment.NewLine +
" }" + Environment.NewLine +
"}", result);
}
[Test]
public void TestLocalDeclaration()
{
string result = RunContextAction (
new ExtractFieldAction (),
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" int $foo;" + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
Console.WriteLine (result);
Assert.AreEqual (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" int foo;" + Environment.NewLine +
"" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" }" + Environment.NewLine +
"}", result);
}
[Test]
public void TestCtorParam ()
{
string result = RunContextAction (
new ExtractFieldAction (),
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" TestClass (int $foo)" + Environment.NewLine +
" {" + Environment.NewLine +
" " + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
Assert.AreEqual (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" int foo;" + Environment.NewLine +
"" + Environment.NewLine +
" TestClass (int foo)" + Environment.NewLine +
" {" + Environment.NewLine +
" this.foo = foo;" + Environment.NewLine +
" " + Environment.NewLine +
" }" + Environment.NewLine +
"}", result);
}
}
}

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

@ -1,4 +1,4 @@
// //
// TestRefactoringContext.cs // TestRefactoringContext.cs
// //
// Author: // Author:
@ -246,8 +246,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
var doc = new StringBuilderDocument (content); var doc = new StringBuilderDocument (content);
var parser = new CSharpParser (); var parser = new CSharpParser ();
var unit = parser.Parse (content, "program.cs"); var unit = parser.Parse (content, "program.cs");
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (e => Console.WriteLine (e.Message)); Console.WriteLine (error.Message);
Assert.IsFalse (parser.HasErrors, "File contains parsing errors."); Assert.IsFalse (parser.HasErrors, "File contains parsing errors.");
unit.Freeze (); unit.Freeze ();
var parsedFile = unit.ToTypeSystem (); var parsedFile = unit.ToTypeSystem ();

106
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InconsistentNamingTests.cs

@ -57,24 +57,24 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
[Test] [Test]
public void TestClassName () public void TestClassName ()
{ {
var input = @"class anIssue {}"; var input = @"public class anIssue {}";
var output = @"class AnIssue {}"; var output = @"public class AnIssue {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestAttributeName () public void TestAttributeName ()
{ {
var input = @"class test : System.Attribute {}"; var input = @"public class test : System.Attribute {}";
var output = @"class TestAttribute : System.Attribute {}"; var output = @"public class TestAttribute : System.Attribute {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestEventArgsName () public void TestEventArgsName ()
{ {
var input = @"class test : System.EventArgs {}"; var input = @"public class test : System.EventArgs {}";
var output = @"class TestEventArgs : System.EventArgs {}"; var output = @"public class TestEventArgs : System.EventArgs {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
@ -89,50 +89,50 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
[Test] [Test]
public void TestStructName () public void TestStructName ()
{ {
var input = @"struct anIssue {}"; var input = @"public struct anIssue {}";
var output = @"struct AnIssue {}"; var output = @"public struct AnIssue {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestInterfaceName () public void TestInterfaceName ()
{ {
var input = @"interface anIssue {}"; var input = @"public interface anIssue {}";
var output = @"interface IAnIssue {}"; var output = @"public interface IAnIssue {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestEnumName () public void TestEnumName ()
{ {
var input = @"enum anIssue {}"; var input = @"public enum anIssue {}";
var output = @"enum AnIssue {}"; var output = @"public enum AnIssue {}";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestDelegateName () public void TestDelegateName ()
{ {
var input = @"delegate void anIssue ();"; var input = @"public delegate void anIssue ();";
var output = @"delegate void AnIssue ();"; var output = @"public delegate void AnIssue ();";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] // [Test]
public void TestPrivateFieldName () // public void TestPrivateFieldName ()
{ // {
var input = @"class AClass { int Field; }"; // var input = @"class AClass { int Field; }";
var output = @"class AClass { int field; }"; // var output = @"class AClass { int field; }";
CheckNaming (input, output); // CheckNaming (input, output);
} // }
[Test] // [Test]
public void TestUnderscoreFieldName () // public void TestUnderscoreFieldName ()
{ // {
var input = @"class AClass { int _Field; }"; // var input = @"class AClass { int _Field; }";
var output = @"class AClass { int _field; }"; // var output = @"class AClass { int _field; }";
CheckNaming (input, output); // CheckNaming (input, output);
} // }
[Test] [Test]
public void TestPublicFieldName () public void TestPublicFieldName ()
@ -142,13 +142,13 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] // [Test]
public void TestPrivateConstantFieldName () // public void TestPrivateConstantFieldName ()
{ // {
var input = @"class AClass { const int field = 5; }"; // var input = @"class AClass { const int field = 5; }";
var output = @"class AClass { const int Field = 5; }"; // var output = @"class AClass { const int Field = 5; }";
CheckNaming (input, output); // CheckNaming (input, output);
} // }
[Test] [Test]
public void TestPublicReadOnlyFieldName () public void TestPublicReadOnlyFieldName ()
@ -174,13 +174,13 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
CheckNaming (input, output, true); CheckNaming (input, output, true);
} }
[Test] // [Test]
public void TestPrivateStaticFieldName () // public void TestPrivateStaticFieldName ()
{ // {
var input = @"class AClass { static int Field; }"; // var input = @"class AClass { static int Field; }";
var output = @"class AClass { static int field; }"; // var output = @"class AClass { static int field; }";
CheckNaming (input, output); // CheckNaming (input, output);
} // }
[Test] [Test]
public void TestPublicStaticReadOnlyFieldName () public void TestPublicStaticReadOnlyFieldName ()
@ -190,13 +190,13 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] // [Test]
public void TestPrivateReadOnlyFieldName () // public void TestPrivateReadOnlyFieldName ()
{ // {
var input = @"class AClass { readonly int Field; }"; // var input = @"class AClass { readonly int Field; }";
var output = @"class AClass { readonly int field; }"; // var output = @"class AClass { readonly int field; }";
CheckNaming (input, output); // CheckNaming (input, output);
} // }
[Test] [Test]
public void TestPublicConstantFieldName () public void TestPublicConstantFieldName ()
@ -209,16 +209,16 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
[Test] [Test]
public void TestMethodName () public void TestMethodName ()
{ {
var input = @"class AClass { int method () {} }"; var input = @"class AClass { public int method () {} }";
var output = @"class AClass { int Method () {} }"; var output = @"class AClass { public int Method () {} }";
CheckNaming (input, output); CheckNaming (input, output);
} }
[Test] [Test]
public void TestPropertyName () public void TestPropertyName ()
{ {
var input = @"class AClass { int property { get; set; } }"; var input = @"class AClass { public int property { get; set; } }";
var output = @"class AClass { int Property { get; set; } }"; var output = @"class AClass { public int Property { get; set; } }";
CheckNaming (input, output); CheckNaming (input, output);
} }

20
ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs

@ -35,8 +35,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser
CSharpParser parser = new CSharpParser(); CSharpParser parser = new CSharpParser();
CompilationUnit cu = parser.Parse(new StringReader(code), "parsed.cs"); CompilationUnit cu = parser.Parse(new StringReader(code), "parsed.cs");
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (err => Console.WriteLine (err.Message)); Console.WriteLine (error.Message);
Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors");
AstNode node = cu.Children.Single(); AstNode node = cu.Children.Single();
@ -58,8 +58,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser
CSharpParser parser = new CSharpParser(); CSharpParser parser = new CSharpParser();
var statements = parser.ParseStatements(new StringReader(stmt)); var statements = parser.ParseStatements(new StringReader(stmt));
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (err => Console.WriteLine (err.Message)); Console.WriteLine (error.Message);
Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors");
AstNode statement = statements.Single(); AstNode statement = statements.Single();
@ -81,8 +81,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser
CSharpParser parser = new CSharpParser(); CSharpParser parser = new CSharpParser();
AstNode parsedExpression = parser.ParseExpression(new StringReader(expr)); AstNode parsedExpression = parser.ParseExpression(new StringReader(expr));
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (err => Console.WriteLine (err.Message)); Console.WriteLine (error.Message);
Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors");
if (expectErrors && parsedExpression == null) if (expectErrors && parsedExpression == null)
return default (T); return default (T);
@ -103,8 +103,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser
{ {
CSharpParser parser = new CSharpParser(); CSharpParser parser = new CSharpParser();
var members = parser.ParseTypeMembers(new StringReader(expr)); var members = parser.ParseTypeMembers(new StringReader(expr));
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (err => Console.WriteLine (err.Message)); Console.WriteLine (error.Message);
Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors");
EntityDeclaration m = members.Single(); EntityDeclaration m = members.Single();
Type type = typeof(T); Type type = typeof(T);
@ -125,8 +125,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser
CSharpParser parser = new CSharpParser(); CSharpParser parser = new CSharpParser();
var parsedExpression = parser.ParseDocumentationReference(cref); var parsedExpression = parser.ParseDocumentationReference(cref);
if (parser.HasErrors) foreach (var error in parser.Errors)
parser.ErrorPrinter.Errors.ForEach (err => Console.WriteLine (err.Message)); Console.WriteLine (error.Message);
Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors");
if (expectErrors && parsedExpression == null) if (expectErrors && parsedExpression == null)
return null; return null;

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

@ -579,6 +579,40 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
} }
}"); }");
} }
[Test()]
public void TestNoBlankLinesBetweenEndBraceAndEndParenthesis ()
{
CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
policy.BlankLinesBetweenMembers = 1;
var adapter = Test (policy, @"class Test
{
int Foo (int i, double d, Action a)
{
a ();
}
void Bar ()
{
Foo (1, 2, () => {
});
}
}",
@"class Test
{
int Foo (int i, double d, Action a)
{
a ();
}
void Bar ()
{
Foo (1, 2, () => {
});
}
}", FormattingMode.Intrusive);
}
} }
} }

3
ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{63D3B27A-D966-4902-90B3-30290E1692F1}</ProjectGuid> <ProjectGuid>{63D3B27A-D966-4902-90B3-30290E1692F1}</ProjectGuid>
@ -283,6 +283,7 @@
<Compile Include="CSharp\CodeActions\ImplementInterfaceTests.cs" /> <Compile Include="CSharp\CodeActions\ImplementInterfaceTests.cs" />
<Compile Include="CSharp\CodeActions\ImplementInterfaceExplicitTests.cs" /> <Compile Include="CSharp\CodeActions\ImplementInterfaceExplicitTests.cs" />
<Compile Include="CSharp\CodeActions\ImplementAbstractMembersTest.cs" /> <Compile Include="CSharp\CodeActions\ImplementAbstractMembersTest.cs" />
<Compile Include="CSharp\CodeActions\ExtractFieldTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Mono.Cecil\Mono.Cecil.csproj"> <ProjectReference Include="..\..\Mono.Cecil\Mono.Cecil.csproj">

1
ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs

@ -145,7 +145,6 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.AreEqual(0, c.GetProperties().Count()); Assert.AreEqual(0, c.GetProperties().Count());
Assert.AreEqual(0, c.GetEvents().Count()); Assert.AreEqual(0, c.GetEvents().Count());
Assert.AreEqual(0, c.GetFields().Count()); Assert.AreEqual(0, c.GetFields().Count());
Assert.AreEqual(3, c.Attributes.Count);
} }
[Test] [Test]

Loading…
Cancel
Save