How do I initialize a collection of \'Quote\' objects based on the class shown below where \'Quote\' would contain a collection of at least 5 \'Rate\' objects.
List<Quote> quotes = new List<Quote> {
new Quote {
Id = 1,
Rates = new List<Rate> {
new Rate { Id = 1, ...},
new Rate { Id = 2, ...},
...
}
},
...
};
Use a factory method to create such object graphs for you.
List<Quote> quotes = new List<Quote> {
new Quote {
Id = 1,
Rates = new List<Rate> {
new Rate {
Id = 1,
AccommodationType = "Whatever",
Price = 0m
},
new Rate { ......
}
}
}
};