private void GenerateTestData() { var supplierList = ServiceLocator.Current.GetInstance<SupplierListViewModel>(); var r = new Random(); for (int i = 1; i < 4; i++) { var supplier = new SupplierViewModel() { Name = $"Supplier {i}"}; var itemCnt = r.Next(5, 10); var testSkipItem = r.Next(1, itemCnt); for (int j = 1; j <= itemCnt; j++) { if (j == testSkipItem) continue; var item = new ItemViewModel() { Name = $"Item {j}", Cost = r.Next(1, 100) }; supplier.Items.Add(item); } supplierList.Suppliers.Add(supplier); } }
public void InsertSupplierCommandExecute() { var supplier = new SupplierViewModel() {Name = $"Supplier {Suppliers.Count + 1}"}; var r = new Random(); var itemCnt = r.Next(5, 10); var testSkipItem = r.Next(1, itemCnt); for (int j = 1; j <= itemCnt; j++) { if (j == testSkipItem) continue; var item = new ItemViewModel() { Name = $"Item {j}", Cost = r.Next(1, 100) }; supplier.Items.Add(item); } Suppliers.Add(supplier); Messenger.Default.Send(new SupplierAddedMessage()); }