SpecFlow.Assist.Dynamic is a couple of simple extension methods for the SpecFlow Table object that helps you to write less code.
What would you rather write? This:
[Binding]publicclassStepsUsingStaticType{privatePerson_person;[Given(@"I create an instance from this table")]publicvoidGivenICreateAnInstanceFromThisTable(Tabletable){_person=table.CreateInstance<Person>();}[Then(@"the Name property on Person should equal '(.*)'")]publicvoidPersonNameShouldBe(stringexpectedValue){Assert.AreEqual(expectedValue,_person.Name);}}// And then make sure to not forget defining a separate Person class for testing, // since you don't want to reuse the one your system under test is using - that's bad practice// Should probably be in another file too...// might need unit tests if the logic is complicatedpublicclassPerson{publicstringName{get;set;}publicintAge{get;set;}publicDateTimeBirthDate{get;set;}publicdoubleLengthInMeters{get;set;}}Or this:
[Binding]publicclassStepsUsingDynamic{privatedynamic_instance;[Given(@"I create an instance from this table")]publicvoidc(dynamicinstance){_instance=instance;}[Then(@"the Name property should equal '(.*)'")]publicvoidNameShouldBe(stringexpectedValue){Assert.AreEqual(expectedValue,_instance.Name);}}The later version uses SpecFlow.Assist.Dynamic. Shorter, sweater and more fun!
well, this is may be one of the best usecase for dynamic i have ever seen
A happy SpecFlow.Assists.Dynamic user