public void CreateWithMetadata() { Cons cons = new Cons(1, new Cons(2)); IObject iobj = cons.WithMetadata(FakePersistentMap.Instance); Assert.IsNotNull(iobj); Assert.IsInstanceOfType(iobj, typeof(Cons)); Assert.IsTrue(iobj != cons); Assert.IsTrue(FakePersistentMap.Instance == iobj.Metadata); Assert.AreEqual(2, cons.Count); Assert.AreEqual(1, cons.First()); Assert.AreEqual(2, cons.Next().First()); Assert.IsNull(cons.Next().Next()); }
public void CreateWithOneObject() { Cons cons = new Cons(1); Assert.AreEqual(1, cons.First()); Assert.IsNull(cons.Next()); }
public void CreateWithOneObjectAndRest() { Cons cons = new Cons(1, new Cons(2)); Assert.AreEqual(1, cons.First()); ISequence rest = cons.Next(); Assert.IsNotNull(rest); Assert.IsInstanceOfType(rest, typeof(Cons)); Assert.AreEqual(2, rest.First()); Assert.IsNull(rest.Next()); }