public void Init() { //create collection _set = new OrderedNotifySet <object>(); //init event handle _lastEventArgs = null; _set.OnCollectionChanged += (args) => _lastEventArgs = args; }
public void AddAfterNotExistTest() { //arrange ConstructTestSet(1); _lastEventArgs = null; //act-assert Assert.Throws <ArgumentException>(() => _set.AddAfter(new object(), new object())); Assert.Null(_lastEventArgs); }
public void AddAfterDuplicateTest() { //arrange List <object> objectsCollection = ConstructTestSet(1); _lastEventArgs = null; //act-assert Assert.Throws <ArgumentException>(() => _set.AddAfter(objectsCollection[0], objectsCollection[0])); Assert.Null(_lastEventArgs); }
public void AddFirstDuplicationTest() { //arrange var existItem = new object(); _set.Add(existItem); _lastEventArgs = null; //act-assert Assert.Throws <ArgumentException>(() => _set.AddFirst(existItem)); Assert.Null(_lastEventArgs); }
public void RemoveNotExistTest() { //arrange var existItem = new object(); _set.AddFirst(existItem); _lastEventArgs = null; //act bool result = _set.Remove(new object()); //assert Assert.False(result); SetAssert(existItem); Assert.Null(_lastEventArgs); }