示例#1
0
        public void AddNewAndCommit()
        {
            var cut          = new SortedBindingList <Data>();
            var raisedEvents = new List <ListChangedEventArgs>();

            cut.ListChanged += (s, e) => raisedEvents.Add(e);

            const string NewName = "NewName";

            var data = cut.AddNew();

            data.Name = NewName;

            cut.EndNew(0);

            Assert.AreEqual(1, cut.Count);
            Assert.AreEqual(data.Name, cut[0].Name);
        }