Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

CategoryAttribute not working
dpc640
#1 Posted : Wednesday, May 13, 2015 5:44:35 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/15/2014(UTC)
Posts: 8
Location: United States of America

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Remco,

I am trying to setup an engine mode to run specific tests during check-in. I have created a CategoryAttribute per the documentation, applied it to a method and created the engine mode.

I added the Categories column to the test window. NCrunch is not recognizing the category.

Below is the definition of the CategoryAttribute. It is in the same code file as other attributes that I am using.

Thanks,

Patrick

Quote:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NCrunch.Framework
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = true)]
public class RequiresCapabilityAttribute : Attribute
{
public RequiresCapabilityAttribute(string capabilityName)
{
CapabilityName = capabilityName;
}

public string CapabilityName { get; private set; }
}

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = true)]
public class CategoryAttribute : Attribute
{
public CategoryAttribute(string category)
{
CategoryName = category;
}

public string CategoryName { get; private set; }
}

public abstract class ResourceUsageAttribute : Attribute
{
private readonly string[] _resourceNames;

public ResourceUsageAttribute(params string[] resourceName)
{
_resourceNames = resourceName;
}

public string[] ResourceNames
{
get { return _resourceNames; }
}
}

public class ExclusivelyUsesAttribute : ResourceUsageAttribute
{
public ExclusivelyUsesAttribute(params string[] resourceName)
: base(resourceName) { }
}

}

Remco
#2 Posted : Wednesday, May 13, 2015 10:44:30 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi,

I've noticed something not quite right in your declaration of CategoryAttribute. Try changing the property name 'CategoryName' to 'Category'. To avoid any doubt, it's best to copy/paste the declaration from the documentation - http://www.ncrunch.net/documentation/reference_runtime-framework_category-attribute.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download