public BackgroundSteps(ScenarioContext scenarioContext, HorizontalTablePOCO horizontalTableShared, VerticalTablePOCO verticalTableShared) //Added arguments for POCO sharing { //for Specflows ScenarioContext object sharing _scenarioContext = scenarioContext; //POCO sharing this.horizontalTableShared = horizontalTableShared; this.verticalTableShared = verticalTableShared; }
public void GivenAnInlineHorizontalTableWithOneRowOfDataLikeThis(Table table) { //Put the whole table in to a ScenarioContext object with a dictonary key _scenarioContext["HorizontalTable"] = table; //Pro: Easy | Con: Ugly unpacking is done elsewhere //Using POCO //First use CreateInstance to unpack the data in to our local custom POCO //This must be done in to a field accessible to *this* class localHorizontalTablePOCO = table.CreateInstance <HorizontalTablePOCO>(); horizontalTableShared.Username = localHorizontalTablePOCO.Username; horizontalTableShared.Password = localHorizontalTablePOCO.Password; //Or read table values directly in to the POCO that will be injected in to other classes //TableRow row = table.Rows[0]; //horizontalTableShared.Username = row["Username"]; //horizontalTableShared.Password = row["Password"]; }
public POCOSteps(HorizontalTablePOCO horizontalTableShared, VerticalTablePOCO verticalTableShared) { this.horizontalTableShared = horizontalTableShared; this.verticalTableShared = verticalTableShared; }