示例#1
0
        public void ItemIdCollectionGetRange()
        {
            tlog.Debug(tag, $"ItemIdCollectionGetRange START");

            using (ItemIdCollection itemIdCollection = new ItemIdCollection(5))
            {
                var testingTarget = new ItemIdCollection();
                Assert.IsNotNull(testingTarget, "Should be not null!");
                Assert.IsInstanceOf <ItemIdCollection>(testingTarget, "Should be an Instance of ItemIdCollection!");

                testingTarget.AddRange(itemIdCollection);

                try
                {
                    var result = testingTarget.GetRange(0, 0);
                    Assert.IsInstanceOf <ItemIdCollection>(result, "Should be an Instance of ItemIdCollection!");
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception: Failed!");
                }

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"ItemIdCollectionGetRange END (OK)");
        }
示例#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)");
        }
示例#3
0
        public void ItemIdCollectionCopyToWithArrayIndex()
        {
            tlog.Debug(tag, $"ItemIdCollectionCopyToWithArrayIndex START");

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

            var testingTarget = new ItemIdCollection(c);

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

            uint[] array = new uint[4];

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

            tlog.Debug(tag, $"ItemIdCollectionCopyToWithArrayIndex END (OK)");
        }
示例#4
0
        public void ItemIdCollectionCopyToWithCountLessThan0()
        {
            tlog.Debug(tag, $"ItemIdCollectionCopyToWithCountLessThan0 START");

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

            var testingTarget = new ItemIdCollection(c);

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

            try
            {
                uint[] array = new uint[4];
                testingTarget.CopyTo(0, array, 0, -1);
            }
            catch (ArgumentOutOfRangeException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                testingTarget.Dispose();
                tlog.Debug(tag, $"ItemIdCollectionCopyToWithCountLessThan0 END (OK)");
                Assert.Pass("Caught ArgumentOutOfRangeException : Passed!");
            }
        }
示例#5
0
        public void ItemIdCollectionCapacitySetValueLessThanSize()
        {
            tlog.Debug(tag, $"ItemIdCollectionCapacitySetValueLessThanSize START");

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

            var testingTarget = new ItemIdCollection(c);

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

            tlog.Debug(tag, "Count : " + testingTarget.Count);
            tlog.Debug(tag, "Capacity : " + testingTarget.Capacity.ToString());

            try
            {
                testingTarget.Capacity = 3;
            }
            catch (ArgumentOutOfRangeException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                testingTarget.Dispose();
                tlog.Debug(tag, $"ItemIdCollectionCapacitySetValueLessThanSize END (OK)");
                Assert.Pass("Caught ArgumentOutOfRangeException : Passed!");
            }
        }
示例#6
0
        public void ItemIdCollectionSetRange()
        {
            tlog.Debug(tag, $"ItemIdCollectionSetRange START");

            using (ItemIdCollection itemIdCollection = new ItemIdCollection(5))
            {
                uint[] itemId = new uint[] { 1, 2, 3, 4 };
                global::System.Collections.ICollection c = itemId;

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

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

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"ItemIdCollectionSetRange END (OK)");
        }
示例#7
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!");
            }
        }
示例#8
0
        public void ItemIdCollectionReverseWithParameters()
        {
            tlog.Debug(tag, $"ItemIdCollectionReverseWithParameters START");

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

            var testingTarget = new ItemIdCollection(c);

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

            testingTarget.Capacity = 5;

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

            testingTarget.Dispose();

            tlog.Debug(tag, $"ItemIdCollectionReverseWithParameters END (OK)");
        }
示例#9
0
        public void ItemIdCollectionConstructorWithCapacity()
        {
            tlog.Debug(tag, $"ItemIdCollectionConstructorWithCapacity START");

            var testingTarget = new ItemIdCollection(5);

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

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionConstructorWithCapacity END (OK)");
        }
示例#10
0
        public void ItemIdCollectionRepeat()
        {
            tlog.Debug(tag, $"ItemIdCollectionRepeat START");

            var testingTarget = ItemIdCollection.Repeat(6, 4);

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

            Assert.AreEqual(4, testingTarget.Capacity, "Should be equal!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionRepeat END (OK)");
        }
示例#11
0
        public void ItemIdCollectionEnumeratorConstructor()
        {
            tlog.Debug(tag, $"ItemIdCollectionEnumeratorConstructor START");

            using (ItemIdCollection itemIdCollection = new 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.Dispose();
            }

            tlog.Debug(tag, $"ItemIdCollectionEnumeratorConstructor END (OK)");
        }
示例#12
0
        private void CreateDeleteButton()
        {
            mDeleteButton = new Button();
            var mDeleteButtonStyle = new ButtonStyle
            {
                Text            = null,
                BackgroundColor = new Selector <Color>(),
                BackgroundImage = new Selector <string>()
                {
                    Normal = DELETE_IMAGE, Selected = DELETE_IMAGE_SELECTED
                }
            };

            mDeleteButton.ApplyStyle(mDeleteButtonStyle);
            mDeleteButton.IsSelectable           = true;
            mDeleteButton.ParentOrigin           = ParentOrigin.BottomRight;
            mDeleteButton.PivotPoint             = PivotPoint.BottomRight;
            mDeleteButton.PositionUsesPivotPoint = true;
            mDeleteButton.DrawMode      = DrawModeType.Overlay2D;
            mDeleteButton.Size          = new Size(50, 50);
            mDeleteButton.LeaveRequired = true;
            mDeleteButton.Hide();
            mDeleteButton.Clicked += (obj, e) =>
            {
                ItemIdCollection removeList = new ItemIdCollection();
                for (uint i = 0; i < mItemView.GetChildCount(); ++i)
                {
                    View child = mItemView.GetChildAt(i);
                    if (child != null)
                    {
                        View tick = child.FindChildByName("Tick");

                        if (tick != null && tick.Visibility)
                        {
                            removeList.Add(mItemView.GetItemId(child));
                        }
                    }
                }

                if (removeList.Count != 0)
                {
                    mItemView.RemoveItems(removeList, 0.5f);
                }
            };
            NUIApplication.GetDefaultWindow().Add(mDeleteButton);
        }
示例#13
0
        public void ItemIdCollectionRemove()
        {
            tlog.Debug(tag, $"ItemIdCollectionRemove START");

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

            var testingTarget = new ItemIdCollection(c);

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

            testingTarget.Capacity = 5;

            Assert.AreEqual(true, testingTarget.Remove(3), "Should be equal!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionRemove END (OK)");
        }
示例#14
0
        public void ItemIdCollectionConstructor()
        {
            tlog.Debug(tag, $"ItemIdCollectionConstructor START");

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

            var testingTarget = new ItemIdCollection(c);

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

            Assert.IsFalse(testingTarget.IsFixedSize);
            Assert.IsFalse(testingTarget.IsReadOnly);
            Assert.IsFalse(testingTarget.IsSynchronized);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionConstructor END (OK)");
        }
示例#15
0
        public void ItemIdCollectionGetEnumerator()
        {
            tlog.Debug(tag, $"ItemIdCollectionGetEnumerator START");

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

            var testingTarget = new ItemIdCollection(c);

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

            var result = testingTarget.GetEnumerator();

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

            tlog.Debug(tag, $"ItemIdCollectionGetEnumerator END (OK)");
        }
示例#16
0
        public void ItemIdCollectionContains()
        {
            tlog.Debug(tag, $"ItemIdCollectionContains START");

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

            var testingTarget = new ItemIdCollection(c);

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

            testingTarget.Capacity = 5;

            Assert.IsTrue(testingTarget.Contains(2));

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionContains END (OK)");
        }
示例#17
0
        public void ItemIdCollectionThis()
        {
            tlog.Debug(tag, $"ItemIdCollectionThis START");

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

            var testingTarget = new ItemIdCollection(c);

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

            tlog.Debug(tag, testingTarget[1].ToString());

            testingTarget[2] = 5;
            tlog.Debug(tag, testingTarget[2].ToString());

            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionThis END (OK)");
        }
示例#18
0
        public void ItemIdCollectionConstructorWithItemIdCollection()
        {
            tlog.Debug(tag, $"ItemIdCollectionConstructorWithItemIdCollection 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(itemIdCollection);

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

            itemIdCollection.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"ItemIdCollectionConstructorWithItemIdCollection END (OK)");
        }
示例#19
0
        public void ItemIdCollectionEnumeratorCurrent()
        {
            tlog.Debug(tag, $"ItemIdCollectionEnumeratorCurrent START");

            using (ItemIdCollection itemCollection = new ItemIdCollection())
            {
                var testingTarget = new ItemIdCollection.ItemIdCollectionEnumerator(itemCollection);
                Assert.IsNotNull(testingTarget, "Should be not null!");
                Assert.IsInstanceOf <ItemIdCollection.ItemIdCollectionEnumerator>(testingTarget, "Should be an Instance of ItemIdCollectionEnumerator!");

                try
                {
                    tlog.Debug(tag, "Current : " + testingTarget.Current);
                }
                catch (InvalidOperationException e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    testingTarget.Dispose();
                    tlog.Debug(tag, $"ItemIdCollectionEnumeratorCurrent END (OK)");
                    Assert.Pass("Caught InvalidOperationException : passed!");
                }
            }
        }
示例#20
0
        public void ItemIdCollectionCopyToWithNullArray()
        {
            tlog.Debug(tag, $"ItemIdCollectionCopyToWithNullArray START");

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

            var testingTarget = new ItemIdCollection(c);

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

            try
            {
                testingTarget.CopyTo(null);
            }
            catch (ArgumentNullException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                testingTarget.Dispose();
                tlog.Debug(tag, $"ItemIdCollectionCopyToWithNullArray END (OK)");
                Assert.Fail("Caught ArgumentNullException : Failed!");
            }
        }