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

            uint[] itemId = new uint[] { 1, 2, 3, 4 };
            global::System.Collections.ICollection c = itemId;

            var itemIdCollection = new ItemIdCollection(c);

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

            var testingTarget = new ItemIdCollection.ItemIdCollectionEnumerator(itemIdCollection);

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

            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, $"ItemIdCollectionEnumeratorMoveNextNullObject END (OK)");
                Assert.Pass("Caught InvalidOperationException: Passed!");
            }
        }
Exemple #2
0
        public void ItemIdCollectionEnumeratorReset()
        {
            tlog.Debug(tag, $"ItemIdCollectionEnumeratorReset START");

            uint[] itemId = new uint[] { 1, 2, 3, 4 };
            global::System.Collections.ICollection c = itemId;

            var itemIdCollection = new ItemIdCollection(c);

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

            var testingTarget = new ItemIdCollection.ItemIdCollectionEnumerator(itemIdCollection);

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

            testingTarget.MoveNext();

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

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