Skip to content

Instantly share code, notes, and snippets.

@ngbrown
Created November 9, 2012 19:52
Show Gist options
  • Save ngbrown/4047820 to your computer and use it in GitHub Desktop.
Save ngbrown/4047820 to your computer and use it in GitHub Desktop.
It would be nice if SpecFlow accepted custom attributes based off of StepDefinitionBaseAttribute
namespace StepDefinitions
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;
using TechTalk.SpecFlow.Bindings;
/// <summary>
/// Specifies a step definition primarily for 'When' steps that matches for the provided regular expression, but allows re-use in 'Given' steps as well.
/// </summary>
public class WhenGivenAttribute : StepDefinitionBaseAttribute
{
public WhenGivenAttribute()
: this(null)
{
}
public WhenGivenAttribute(string regex)
: base(regex, new[] { StepDefinitionType.Given, StepDefinitionType.When })
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment