public void GetEnumerator() { ConcreteCollection myCollection; myCollection = new ConcreteCollection(4); Assert.IsTrue(null != myCollection.GetEnumerator()); }
public void Count() { ConcreteCollection myCollection; myCollection = new ConcreteCollection(4); Assert.IsTrue(4 == myCollection.Count); }
public void Remove() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; // Set up a test collection myCollection = new ConcreteCollection(numberOfItems); // The list is 0-based. So if we remove the second one myCollection.RemoveAt(1); // We should see the original third one in it's place Assert.IsTrue(myCollection.PeekAt(1) == 2); Assert.IsTrue(myCollection.onRemoveFired); Assert.IsTrue(myCollection.onRemoveIndex == 1); Assert.IsTrue(myCollection.onRemoveCompleteFired); Assert.IsTrue(myCollection.onRemoveCompleteIndex == 1); IList listObj = myCollection; listObj.Remove(0); // Confirm parameters are being passed to the hooks Assert.IsTrue(myCollection.onRemoveIndex == 0); Assert.IsTrue(myCollection.onRemoveCompleteIndex == 0); }
public void SetCompleteUndo() { ConcreteCollection coll = new ConcreteCollection(0); bool throwsException = true; coll.BaseList.Add(88); coll.onValidateFired = false; coll.onInsertFired = false; coll.onSetCompleteFired = false; coll.mustThrowException = 3; try { coll.BaseList [0] = 11; throwsException = false; } catch { } finally { Assert.IsTrue(throwsException); Assert.IsTrue(coll.onValidateFired); Assert.IsTrue(coll.onSetFired); Assert.IsTrue(coll.onSetCompleteFired); Assert.AreEqual(88, coll.BaseList [0]); } }
public void Clear() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 1; myCollection = new ConcreteCollection(numberOfItems); myCollection.Clear(); Assert.IsTrue(myCollection.Count == 0); Assert.IsTrue(myCollection.onClearFired); Assert.IsTrue(myCollection.onClearCompleteFired); }
public void InsertComplete_Add() { ConcreteCollection coll = new ConcreteCollection(0); coll.mustThrowException = 1; try { coll.BaseList.Add(0); } catch { } Assert.AreEqual(0, coll.Count); }
public void SimpleTest() { ConcreteCollection <int> collection = new ConcreteCollection <int>(); collection.AddValue(1); collection.AddValue(2); collection.AddValue(3); collection.AddValue(40); collection.AddValue(50); CollectionAssert.AreEqual(new int[] { 1, 2, 3, 40, 50 }, collection.ToList()); }
public void SetCompleteCalled() { ConcreteCollection coll = new ConcreteCollection(0); coll.BaseList.Add(88); coll.mustThrowException = 1; try { coll.BaseList [0] = 11; } catch { } finally { Assert.AreEqual(false, coll.onSetCompleteFired); } }
public void ValidateCalled() { ConcreteCollection coll = new ConcreteCollection(0); coll.mustThrowException = 1; try { coll.BaseList [5] = 8888; } catch (ArgumentOutOfRangeException) { throw; } finally { Assert.AreEqual(false, coll.onValidateFired); } }
public void Set() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; myCollection = new ConcreteCollection(numberOfItems); IList listObj = myCollection; listObj[0] = 99; Assert.IsTrue((int)listObj[0] == 99); Assert.IsTrue(myCollection.onSetFired); Assert.IsTrue(myCollection.onSetCompleteFired); Assert.IsTrue(myCollection.onSetOldValue == 0); Assert.IsTrue(myCollection.onSetCompleteOldValue == 0); Assert.IsTrue(myCollection.onSetNewValue == 99); Assert.IsTrue(myCollection.onSetCompleteNewValue == 99); }
public void Insert() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; // The constructor inserts myCollection = new ConcreteCollection(numberOfItems); Assert.IsTrue(myCollection.onInsertFired); Assert.IsTrue(myCollection.onInsertCompleteFired); // Using the IList interface, check inserts in the middle IList listObj = myCollection; listObj.Insert(1, 9); Assert.IsTrue(myCollection.onInsertIndex == 1); Assert.IsTrue(myCollection.onInsertCompleteIndex == 1); Assert.IsTrue(myCollection.PeekAt(1) == 9); }
public void ValidateCalled() { ConcreteCollection coll = new ConcreteCollection(0); coll.mustThrowException = 1; try { coll.BaseList [5] = 8888; } catch (ArgumentOutOfRangeException e) { Console.WriteLine(e); //throw; } catch (Exception exc) { Console.WriteLine("Unexpected exception: " + exc); } finally { AssertEquals(false, coll.onValidateFired); } }
public void Count() { ConcreteCollection myCollection; myCollection = new ConcreteCollection(4); Assert(4 == myCollection.Count); }
public void GetEnumerator() { ConcreteCollection myCollection; myCollection = new ConcreteCollection(4); Assert(null != myCollection.GetEnumerator()); }
public void OnValid() { ConcreteCollection myCollection; myCollection = new ConcreteCollection(); }
public void Set() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; myCollection = new ConcreteCollection(numberOfItems); IList listObj = myCollection; listObj[0] = 99; Assert((int) listObj[0] == 99); Assert(myCollection.onSetFired); Assert(myCollection.onSetCompleteFired); Assert(myCollection.onSetOldValue == 0); Assert(myCollection.onSetCompleteOldValue == 0); Assert(myCollection.onSetNewValue == 99); Assert(myCollection.onSetCompleteNewValue == 99); }
public void Insert() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; // The constructor inserts myCollection = new ConcreteCollection(numberOfItems); Assert(myCollection.onInsertFired); Assert(myCollection.onInsertCompleteFired); // Using the IList interface, check inserts in the middle IList listObj = myCollection; listObj.Insert(1, 9); Assert(myCollection.onInsertIndex == 1); Assert(myCollection.onInsertCompleteIndex == 1); Assert(myCollection.PeekAt(1) == 9); }
public void Clear() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 1; myCollection = new ConcreteCollection(numberOfItems); myCollection.Clear(); Assert(myCollection.Count == 0); Assert(myCollection.onClearFired); Assert(myCollection.onClearCompleteFired); }
// Constructor public ConcreteIterator(ConcreteCollection aggregate) { this._aggregate = aggregate; }
public void InvalidRemove() { ConcreteCollection coll = new ConcreteCollection(0); coll.BaseList.Remove(10); }
public void SetCompleteCalled () { ConcreteCollection coll = new ConcreteCollection (0); coll.BaseList.Add (88); coll.mustThrowException = 1; try { coll.BaseList [0] = 11; } catch { } finally { AssertEquals (false, coll.onSetCompleteFired); } }
public void ValidateCalled () { ConcreteCollection coll = new ConcreteCollection (0); coll.mustThrowException = 1; try { coll.BaseList [5] = 8888; } catch (ArgumentOutOfRangeException) { throw; } finally { AssertEquals (false, coll.onValidateFired); } }
public void InsertComplete_Add () { ConcreteCollection coll = new ConcreteCollection (0); coll.mustThrowException = 1; try { coll.BaseList.Add (0); } catch { } AssertEquals (0, coll.Count); }
public void SetCompleteUndo () { ConcreteCollection coll = new ConcreteCollection (0); bool throwsException = true; coll.BaseList.Add (88); coll.onValidateFired = false; coll.onInsertFired = false; coll.onSetCompleteFired = false; coll.mustThrowException = 3; try { coll.BaseList [0] = 11; throwsException = false; } catch { } finally { Assert (throwsException); Assert (coll.onValidateFired); Assert (coll.onSetFired); Assert (coll.onSetCompleteFired); AssertEquals (88, coll.BaseList [0]); } }
public void Remove() { ConcreteCollection myCollection; int numberOfItems; numberOfItems = 3; // Set up a test collection myCollection = new ConcreteCollection(numberOfItems); // The list is 0-based. So if we remove the second one myCollection.RemoveAt(1); // We should see the original third one in it's place Assert(myCollection.PeekAt(1) == 2); Assert(myCollection.onRemoveFired); Assert(myCollection.onRemoveIndex == 1); Assert(myCollection.onRemoveCompleteFired); Assert(myCollection.onRemoveCompleteIndex == 1); IList listObj = myCollection; listObj.Remove(0); // Confirm parameters are being passed to the hooks Assert(myCollection.onRemoveIndex == 0); Assert(myCollection.onRemoveCompleteIndex == 0); }
// Constructor public Iterator(ConcreteCollection collection) { this.collection = collection; }
public void InvalidRemove () { ConcreteCollection coll = new ConcreteCollection (0); coll.BaseList.Remove (10); }