public void AddItemTest() { var newItem = new SortObj("New Item"); var currentItems = _collection.Count; _collection.Add(newItem); Assert.AreEqual(currentItems + 1, newItem.SortOrder); }
public void UnknownItemTest() { var knownItem = _collection[0]; var unknownItem = new SortObj("Devil"); Assert.Throws <ArgumentException>(() => _collection.InsertBefore(unknownItem, knownItem)); Assert.Throws <ArgumentException>(() => _collection.InsertAfter(unknownItem, knownItem)); Assert.Throws <ArgumentException>(() => _collection.MoveUp(unknownItem)); Assert.Throws <ArgumentException>(() => _collection.MoveDown(unknownItem)); }
public void InsertBeforeTest(int beforeItemIndex, int originTargetIndex, int changedItemsCount) { var beforeItem = _collection[beforeItemIndex]; var newItem = new SortObj("E"); _collection.InsertBefore(beforeItem, newItem); var changedItems = _collection.FlushModifications(); Assert.AreEqual(originTargetIndex, _collection.IndexOf(beforeItem)); Assert.AreEqual(changedItemsCount, changedItems.Count); Assert.IsTrue(changedItems.Contains(newItem)); }