Skip to main content

[SpecFlow] Define a way to initialize Binding/Step Class to be Generic

Comments

2 comments

  • Vineet Kumar

    Andreas Willich thanks for looking at this.

    For each scenario specflow instantiate the [Binding] class. I wanted a way to have some control over initiation of these classes so that I can make them  generic class. I want to write something like following 

    [Binding]
    public class ProcessPortfolio<T>
    {
           private IPortfolio<T> Portfolio{get; set;}
           [Given("The Portfolio is of Type (.*)")]
           public void GivenTheFirstNumberIs(int type)
           {
                Portfolio.TypeId = type;
            }
    }

    I wanted some control over initiating ProcessPortfolio class based on may be feature/feature Tag/Scenario Tag or other means of transforming the type of <T>.

    This would enable me to write my steps only once and bases on portfolio I could reuse the steps.

     

     

    1
  • Andreas Willich

    Could you elaborate a little bit more what you are suggesting here? 

    What is for you a generic step/binding class?

    0

Please sign in to leave a comment.

Powered by Zendesk