Exemple #1
0
        public void ItemCollectionItemCollectionEnumeratorMoveNextNullObject()
        {
            tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNextNullObject START");

            Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
            global::System.Collections.ICollection c = b;
            var itemCollection = new ItemCollection(c);

            Assert.IsNotNull(itemCollection, "Should be not null!");
            Assert.IsInstanceOf <ItemCollection>(itemCollection, "Should be an Instance of ItemCollection!");

            var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");

            try
            {
                testingTarget.MoveNext();
                testingTarget.MoveNext();
                testingTarget.MoveNext();
                testingTarget.MoveNext();
                testingTarget.MoveNext();
                var result = testingTarget.Current;
            }
            catch (InvalidOperationException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                testingTarget.Dispose();
                tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNextNullObject END (OK)");
                Assert.Pass("Caught InvalidOperationException: Passed!");
            }
        }
Exemple #2
0
        public void ItemCollectionItemCollectionEnumeratorReset()
        {
            tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorReset START");

            Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
            global::System.Collections.ICollection c = b;
            var itemCollection = new ItemCollection(c);

            Assert.IsNotNull(itemCollection, "Should be not null!");
            Assert.IsInstanceOf <ItemCollection>(itemCollection, "Should be an Instance of ItemCollection!");

            var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");

            testingTarget.MoveNext();

            try
            {
                testingTarget.Reset();
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception: Failed!");
            }

            tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorReset END (OK)");
        }