public void GetAllItemsRecursive() { SimplerModel model = new SimplerModel(); var dataItem = new DataItem(); model.DataItems.Add(dataItem); var items = model.GetAllItemsRecursive().ToArray(); Assert.AreEqual(new object[] { model, model.DataItems[0], model.DataItems[1], model.DataItems[2], model.DataItems[3], dataItem, model.DataItems[0].Value, model.DataItems[1].Value, model.DataItems[2].Value, model.DataItems[3].Value }, model.GetAllItemsRecursive().ToArray()); }
public void GetAllItemsRecursiveShouldReturnModels() { var compositeModel = new CompositeModel(); var model = new SimplerModel(); compositeModel.Models.Add(model); IEnumerable <object> enumerable = compositeModel.GetAllItemsRecursive(); Assert.IsTrue(enumerable.Contains(model)); Assert.AreEqual( 1 + compositeModel.DataItems.Count * 2 + model.GetAllItemsRecursive().Count(), enumerable.Count()); }