public void SnocTest() { var queue = BankersQueue <string> .Snoc(BankersQueue <string> .Empty, "one"); queue = BankersQueue <string> .Snoc(queue, "two"); Assert.AreEqual("[1, {$one}, 1, {$two}]", DumpQueue(queue, true)); }
public void EmptyTest() { var queue = BankersQueue <string> .Empty; Assert.IsTrue(BankersQueue <string> .IsEmpty(queue)); queue = BankersQueue <string> .Snoc(queue, "Item"); Assert.IsFalse(BankersQueue <string> .IsEmpty(queue)); queue = BankersQueue <string> .Tail(queue); Assert.IsTrue(BankersQueue <string> .IsEmpty(queue)); }
public void NullSnocTest() { var ex = AssertThrows <NullReferenceException>(() => BankersQueue <string> .Snoc(null, "one")); Assert.AreEqual("Object reference not set to an instance of an object.", ex.Message); }