Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tags/ReSharper Unit Test Categories are only determined on the Contex…

…tElement level and inherited to element below (Specification, Behaviors, Behavior Specifications)
  • Loading branch information...
commit 32080024c661f04430aea88f0cc5585cac8201fc 1 parent 5c3fd12
@agross agross authored
View
6 Source/Machine.Specifications.ReSharperRunner.6.1/Factories/ContextSpecificationFactory.cs
@@ -1,5 +1,3 @@
-using System.Collections.Generic;
-
using JetBrains.Metadata.Reader.API;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi;
@@ -64,7 +62,6 @@ public ContextSpecificationElement CreateContextSpecification(IDeclaredElement f
_projectEnvoy,
clazz.GetClrName().GetPersistent(),
field.ShortName,
- clazz.GetTags(),
field.IsIgnored());
}
@@ -79,7 +76,6 @@ public ContextSpecificationElement CreateContextSpecification(ContextElement con
_projectEnvoy,
_reflectionTypeNameCache.GetClrName(specification.DeclaringType),
specification.Name,
- specification.DeclaringType.GetTags(),
specification.IsIgnored());
}
@@ -92,7 +88,6 @@ public ContextSpecificationElement CreateContextSpecification(ContextElement con
ProjectModelElementEnvoy projectEnvoy,
IClrTypeName declaringTypeName,
string fieldName,
- ICollection<string> tags,
bool isIgnored)
{
var id = ContextSpecificationElement.CreateId(context, fieldName);
@@ -111,7 +106,6 @@ public ContextSpecificationElement CreateContextSpecification(ContextElement con
projectEnvoy,
declaringTypeName,
fieldName,
- tags,
isIgnored);
}
}
View
11 Source/Machine.Specifications.ReSharperRunner.6.1/Presentation/BehaviorElement.cs
@@ -55,7 +55,16 @@ public override string Kind
public override IEnumerable<UnitTestElementCategory> Categories
{
- get { return UnitTestElementCategory.Uncategorized; }
+ get
+ {
+ var parent = Parent ?? Context;
+ if (parent == null)
+ {
+ return UnitTestElementCategory.Uncategorized;
+ }
+
+ return parent.Categories;
+ }
}
public override string Id
View
11 Source/Machine.Specifications.ReSharperRunner.6.1/Presentation/BehaviorSpecificationElement.cs
@@ -51,7 +51,16 @@ public override string Kind
public override IEnumerable<UnitTestElementCategory> Categories
{
- get { return UnitTestElementCategory.Uncategorized; }
+ get
+ {
+ var parent = Parent ?? Behavior;
+ if (parent == null)
+ {
+ return UnitTestElementCategory.Uncategorized;
+ }
+
+ return parent.Categories;
+ }
}
public override string Id
View
20 Source/Machine.Specifications.ReSharperRunner.6.1/Presentation/ContextSpecificationElement.cs
@@ -7,7 +7,6 @@
using JetBrains.ReSharper.Psi.Caches;
using JetBrains.ReSharper.UnitTestFramework;
using JetBrains.ReSharper.UnitTestFramework.Elements;
-using JetBrains.Util;
using Machine.Specifications.ReSharperRunner.Factories;
@@ -15,7 +14,6 @@ namespace Machine.Specifications.ReSharperRunner.Presentation
{
class ContextSpecificationElement : FieldElement
{
- readonly IEnumerable<UnitTestElementCategory> _categories;
readonly string _id;
public ContextSpecificationElement(MSpecUnitTestProvider provider,
@@ -27,7 +25,6 @@ class ContextSpecificationElement : FieldElement
ProjectModelElementEnvoy project,
IClrTypeName declaringTypeName,
string fieldName,
- IEnumerable<string> tags,
bool isIgnored)
: base(
provider,
@@ -40,11 +37,6 @@ class ContextSpecificationElement : FieldElement
isIgnored || context.Explicit)
{
_id = CreateId(context, fieldName);
-
- if (tags != null)
- {
- _categories = UnitTestElementCategory.Create(tags);
- }
}
public ContextElement Context
@@ -59,7 +51,16 @@ public override string Kind
public override IEnumerable<UnitTestElementCategory> Categories
{
- get { return _categories; }
+ get
+ {
+ var parent = Parent ?? Context;
+ if (parent == null)
+ {
+ return UnitTestElementCategory.Uncategorized;
+ }
+
+ return parent.Categories;
+ }
}
public override string Id
@@ -103,7 +104,6 @@ CacheManager cacheManager
ProjectModelElementEnvoy.Create(project),
new ClrTypeName(typeName),
methodName,
- EmptyArray<string>.Instance,
isIgnored);
}
View
9 Source/Machine.Specifications.ReSharperRunner.6.1/Presentation/Element.cs
@@ -263,7 +263,14 @@ protected ITypeElement GetDeclaredType()
var declarationsCache = _cacheManager.GetDeclarationsCache(psiModule, true, true);
- return declarationsCache.GetTypeElementByCLRName(_declaringTypeName);
+ try
+ {
+ return declarationsCache.GetTypeElementByCLRName(_declaringTypeName);
+ }
+ catch (NullReferenceException)
+ {
+ return null;
+ }
}
public IClrTypeName GetTypeClrName()
Please sign in to comment.
Something went wrong with that request. Please try again.