Using SpecFlow in a C# -Entity Framework application, I'm trying to set up test data for an Entity of below structure.
public partial class TYPE1
{
public int Prop1 { get; set; }
public virtual ICollection<TYPE2> Prop2 { get; set; }
}
public partial class TYPE2
{
public int Prop3 { get; set; }
}
Test data :
Given I have a Type1 record with following data
| Prop1 | Prop2 |
| 123 | 0 |
[Given(@"I have a Type1 record with following data")]
public void GivenIHaveAType1RecordWithFollowingData(Table table)
{
foreach (var row in table.Rows)
{
var record =
this.PopulateModelFromTableRow<TYPE1>(row);
this.test.DbContext.TYPE1.Add(record);
}
}
I'm trying to figure out a way to assign Prop2 a list of Type 2 values. How can i do that?