[SpecFlow] Define a way to initialize Binding/Step Class to be Generic
In order to implement good coding practices around SOLID principles and clean coding having a generic step/Binding Class would help.
For every scenario the Binding Class is initialized but there is no way to make them a generic class, having this feature will allow us to create extendable steps files.
-
Could you elaborate a little bit more what you are suggesting here?
What is for you a generic step/binding class?
0 -
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
Please sign in to leave a comment.
Comments
2 comments