Example #1
0
        public void TestGetAny()
        {
            IStackSet <IScheduleNode> stackSet    = new StackSet <IScheduleNode>();
            IScheduleNode             testNumber  = new DummyNode(1);
            IScheduleNode             testNumber2 = new DummyNode(5);

            stackSet.Push(testNumber);
            stackSet.Push(testNumber2);
            IScheduleNode poppedElement = stackSet.GetAny();

            Assert.True(
                (poppedElement.Equals(testNumber2) || poppedElement.Equals(testNumber)) &&
                stackSet.Count() == 2, "PopAny didn't work.");
        }
Example #2
0
        public void TestRemove()
        {
            IStackSet <IScheduleNode> stackSet    = new StackSet <IScheduleNode>();
            IScheduleNode             testNumber  = new DummyNode(1);
            IScheduleNode             testNumber2 = new DummyNode(5);

            stackSet.Push(testNumber);
            stackSet.Push(testNumber2);
            stackSet.Remove(testNumber);
            Assert.True(stackSet.GetAny().Equals(testNumber2) && stackSet.Count() == 1,
                        "Remove didn't work.");
            stackSet.Remove(testNumber2);
            Assert.True(stackSet.Any() == false && stackSet.Count() == 0, "Remove didn't work.");
        }