Example #1
0
        public void PeekYieldsFirstElementAndListUnchanged()
        {
            PersistentList p = (PersistentList)PersistentList.create(new object[] { "abc", 1, "def" });

            Expect(p.peek(), EqualTo("abc"));
            Expect(p.count(), EqualTo(3));
        }
Example #2
0
        public void PopLosesfirstElement()
        {
            PersistentList p  = (PersistentList)PersistentList.create(new object[] { "abc", 1, "def" });
            PersistentList p2 = (PersistentList)p.pop();

            Expect(p2.count(), EqualTo(2));
            Expect(p2.peek(), EqualTo(1));
        }
Example #3
0
        public void OneArgCtorConstructsListOfOneElement()
        {
            PersistentList p = new PersistentList("abc");

            Expect(p.first(), EqualTo("abc"));
            Expect(p.next(), Null);
            Expect(p.count(), EqualTo(1));
        }
        public void OneArgCtorConstructsListOfOneElement()
        {
            PersistentList p = new PersistentList("abc");

            Expect(p.first()).To.Equal("abc");
            Expect(p.next()).To.Be.Null();
            Expect(p.count()).To.Equal(1);
        }