public void CtorList() { List <TestObject> items = Enumerable.Repeat(0, 10).Select(x => TestObject.GenerateRandom()).ToList(); Array <TestObject> a = new Array <TestObject>(items); Assert.Equal(10, a.Count); Assert.Equal(items[9], a[9]); }
public void ModifyItem() { var raisedItemEvents = new List <ItemStateChangedEventArgs>(); var raisedPropertyEvents = new List <PropertyChangedEventArgs>(); Array <TestObject> a = Generator.Array(10, g => TestObject.GenerateRandom()); a.ItemStateChanged += delegate(object sender, ItemStateChangedEventArgs e) { raisedItemEvents.Add(e); }; a.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { raisedPropertyEvents.Add(e); }; a[5].Value = 1234; Assert.Single(raisedItemEvents); Assert.Equal(5, raisedItemEvents[0].ItemIndex); Assert.Equal(nameof(TestObject.Value), raisedItemEvents[0].PropertyName); Assert.Empty(raisedPropertyEvents); }