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 PushPopTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(BankersQueue <string> .Empty, BankersQueue <string> .Snoc); foreach (var expected in data.Split()) { var actual = BankersQueue <string> .Head(queue); Assert.AreEqual(expected, actual); queue = BankersQueue <string> .Tail(queue); } Assert.IsTrue(BankersQueue <string> .IsEmpty(queue)); }
public void NullTest() { AssertThrows <NullReferenceException>(() => BankersQueue <string> .IsEmpty(null)); }