Beispiel #1
0
        public void TestSingle()
        {
            var sl = new SquareList <int>();

            sl.Insert(13);
            Assert.AreEqual(13, sl.Min);
            Assert.AreEqual(13, sl.Max);
            var slref = new SquareList <SimpleComparable>();
            var c     = new SimpleComparable(13);

            slref.Insert(c);
            Assert.AreSame(c, slref.Min);
            Assert.AreSame(c, slref.Max);
        }
Beispiel #2
0
        public void TestSmall()
        {
            var sl = new SquareList <int>();

            sl.Insert(13);
            sl.Insert(39);
            sl.Insert(93);
            Assert.AreEqual(13, sl.Min);
            Assert.AreEqual(93, sl.Max);
            var slref = new SquareList <SimpleComparable>();
            var c1    = new SimpleComparable(13);
            var c2    = new SimpleComparable(39);
            var c3    = new SimpleComparable(93);

            slref.Insert(c1);
            slref.Insert(c2);
            slref.Insert(c3);
            Assert.AreSame(c3, slref.Min);
            Assert.AreSame(c1, slref.Max);
        }
Beispiel #3
0
        public void TestEnumeration()
        {
            var sl = new SquareList <int>();

            sl.Insert(13);
            sl.Insert(39);
            sl.Insert(93);
            Assert.AreEqual(13, sl.Min);
            Assert.AreEqual(93, sl.Max);
            Assert.AreEqual(3, sl.Count());
            Assert.IsTrue(sl.SequenceEqual(new int[] { 13, 39, 93 }));
            var slref = new SquareList <SimpleComparable>();
            var c1    = new SimpleComparable(13);
            var c2    = new SimpleComparable(39);
            var c3    = new SimpleComparable(93);

            slref.Insert(c1);
            slref.Insert(c2);
            slref.Insert(c3);
            Assert.AreSame(c3, slref.Min);
            Assert.AreSame(c1, slref.Max);
            Assert.AreEqual(3, slref.Count());
            Assert.IsTrue(slref.SequenceEqual(new SimpleComparable[] { c3, c2, c1 }));
        }