public void HasNextWithTwoElementsShouldReturnTrue() { this.list.Add("Pesho"); this.list.Add("Stamat"); this.collection = new IterableCollection(this.list); bool hasNext = this.collection.HasNext(); Assert.IsTrue(hasNext); }
public void OneMoveWithTwoElementsShouldReturnTrue() { this.list.Add("Pesho"); this.list.Add("Stamat"); this.collection = new IterableCollection(this.list); bool hasMoved = this.collection.Move(); Assert.IsTrue(hasMoved); }
public void Search_PersonClassFalseDelegate_EnumeratorNotNull() { // Arrange var iterator = new IterableCollection <Person>(); // Act var enumerator = iterator.Search(person => false); // Assert Assert.IsNotNull(enumerator); }
public void GetReverseEnumerator_PersonClass_EnumeratorNotNull() { // Arrange var iterator = new IterableCollection <Person>(); // Act var enumerator = iterator.GetReverseIterator(); // Assert Assert.IsNotNull(enumerator); }
public void OneMoveShouldMoveInternalIndexByOne() { this.list.Add("Pesho"); this.list.Add("Stamat"); this.collection = new IterableCollection(this.list); int beforeMove = this.collection.CurrentIndex; this.collection.Move(); int afterMove = this.collection.CurrentIndex; Assert.AreEqual(0, beforeMove); Assert.AreEqual(1, afterMove, "Move() doesn't move the internal index!"); }
public void Add_ReferenceType_ItemAdded() { // Arrange var iterator = new IterableCollection <Person>(); var item = new Person(); Person result; // Act iterator.Add(item); using (var enumerator = iterator.GetEnumerator()) { enumerator.MoveNext(); result = enumerator.Current; } // Assert Assert.AreSame(item, result); }
public ConcreteIterator(IterableCollection collection) { _collection = collection; }
public ListIterator(IterableCollection iterableCollection) { this.IterableCollection = iterableCollection; }
public void PrintMethodOnEmptyCollectionShouldThrow() { this.collection = new IterableCollection(this.list); this.collection.Print(); }
public void ConstructorShouldThrowWithNullCollection() { this.list = null; this.collection = new IterableCollection(this.list); }
public void ConstructorShouldNotThrowWithEmptyCollection() { this.collection = new IterableCollection(this.list); Assert.IsTrue(this.collection.Collection.Count == 0); }