Ejemplo n.º 1
0
        public void TestTrackableCollection_Pop(bool track)
        {
            var             acc  = new Accumulator("test");
            IStack <Simple> coll = new TrackableCollection <Simple>(acc, track);

            Assert.AreEqual(0, coll.Count());
            var a = new Simple("a");
            var b = new Simple("b");

            coll.Push(a);
            coll.Push(b);
            var b1 = coll.Pop();

            Assert.AreEqual(b, b1);
            Assert.AreEqual(1, coll.Count());
            var a1 = coll.Pop();

            Assert.AreEqual(a, a1);
            Assert.AreEqual(0, coll.Count());

            if (track)
            {
                Assert.AreEqual(4, acc.Records.Count);
            }
            else
            {
                Assert.AreEqual(0, acc.Records.Count);
            }
        }
Ejemplo n.º 2
0
        public void TestTrackableCollection_Pop_Empty()
        {
            IStack <Simple> coll = new TrackableCollection <Simple>();

            Assert.AreEqual(0, coll.Count());
            coll.Pop();
        }