Open
Description
I have following classes without any inheritance:
public class Position
{
public int Company;
public int LeaseNumber;
public decimal Costs;
}
public class SubPostion
{
public int LeaseNumber;
public int InventoryNumber;
public string Status;
}
These will be joined in the database based on the LeaseNumber. Therefor I would like to create SubPositions based on the data of positions by using the Position object as some kind of template object so that properties that have the same name in both classes will get the same data.
var position = Randomizer<Position>.Create();
var setup = FillerSetup.Create<SubPosition>().UseTemplate(position).Result;
var subPositions = Randomizer<SubPosition>.Create(setup, 10);
In the case above, all subPositions have random data for InventoryNumber and Status but the same LeaseNumber as the Position object.
It is important, that the template object does not need to be of the same type as the objects are I want to create. Thus we need to check for each property if the template has a property with the same name.