public void ClearNonEmptyList(T[] items) { SegmentedList <T> list = new SegmentedList <T>(items); list.Clear(); Assert.Equal(0, list.Count); //"Should be equal to 0." }
public void ClearEmptyList() { SegmentedList <T> list = new SegmentedList <T>(); Assert.Equal(0, list.Count); //"Should be equal to 0" list.Clear(); Assert.Equal(0, list.Count); //"Should be equal to 0." }
public void ClearMultipleTimesNonEmptyList(T[] items, int times) { SegmentedList <T> list = new SegmentedList <T>(items); for (int i = 0; i < times; i++) { list.Clear(); Assert.Equal(0, list.Count); //"Should be equal to 0." } }
public void ForEach_Verify(int count) { SegmentedList <T> list = GenericListFactory(count); SegmentedList <T> visitedItems = new SegmentedList <T>(); Action <T> action = delegate(T item) { visitedItems.Add(item); }; //[] Verify ForEach looks at every item visitedItems.Clear(); list.ForEach(action); VerifyList(list, visitedItems); }
public HistoryMemento ImportMultipleFiles(DocumentWorkspace documentWorkspace, string[] fileNames) { HistoryMemento memento = null; SegmentedList <HistoryMemento> historyMementos = new SegmentedList <HistoryMemento>(); Rectangle empty = Rectangle.Empty; foreach (string str in fileNames) { HistoryMemento item = this.ImportOneFile(documentWorkspace, str, out empty); if (item != null) { historyMementos.Add(item); } else { this.Rollback(historyMementos); historyMementos.Clear(); break; } } if ((empty.Width > 0) && (empty.Height > 0)) { SelectionHistoryMemento memento3 = new SelectionHistoryMemento(null, null, documentWorkspace); historyMementos.Add(memento3); using (documentWorkspace.Selection.UseChangeScope()) { documentWorkspace.Selection.Reset(); documentWorkspace.Selection.SetContinuation(empty.ToRectInt32(), SelectionCombineMode.Replace); documentWorkspace.Selection.CommitContinuation(); } } if (historyMementos.Count > 0) { HistoryMemento[] actions = historyMementos.ToArrayEx <HistoryMemento>(); memento = new CompoundHistoryMemento(StaticName, StaticImage, actions); } return(memento); }