コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void Search_PersonClassFalseDelegate_EnumeratorNotNull()
        {
            // Arrange
            var iterator = new IterableCollection <Person>();

            // Act
            var enumerator = iterator.Search(person => false);

            // Assert
            Assert.IsNotNull(enumerator);
        }
コード例 #4
0
        public void GetReverseEnumerator_PersonClass_EnumeratorNotNull()
        {
            // Arrange
            var iterator = new IterableCollection <Person>();

            // Act
            var enumerator = iterator.GetReverseIterator();

            // Assert
            Assert.IsNotNull(enumerator);
        }
コード例 #5
0
        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!");
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public ConcreteIterator(IterableCollection collection)
 {
     _collection = collection;
 }
コード例 #8
0
 public ListIterator(IterableCollection iterableCollection)
 {
     this.IterableCollection = iterableCollection;
 }
コード例 #9
0
 public void PrintMethodOnEmptyCollectionShouldThrow()
 {
     this.collection = new IterableCollection(this.list);
     this.collection.Print();
 }
コード例 #10
0
 public void ConstructorShouldThrowWithNullCollection()
 {
     this.list       = null;
     this.collection = new IterableCollection(this.list);
 }
コード例 #11
0
 public void ConstructorShouldNotThrowWithEmptyCollection()
 {
     this.collection = new IterableCollection(this.list);
     Assert.IsTrue(this.collection.Collection.Count == 0);
 }