public void CanAddData() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(7); Assert.IsTrue(queue.Count == 1); Assert.AreEqual(7, queue.Peek()); }
public void QueueCanBeMadeToArray() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(1); queue.Enqueue(5); queue.Enqueue(6); int[] toArray = queue.ToArray(); Assert.IsInstanceOfType(toArray, typeof(int[])); }
public void ToStringReturnsStringWithAllItems() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(1); queue.Enqueue(5); queue.Enqueue(6); string result = queue.ToString(); string expected = "1 5 6"; Assert.AreEqual(expected, result); }
public void CanVerifyIfElementExistsInQueueOrNot() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(7); queue.Enqueue(77); bool existing = queue.Contains(7); bool notExisting = queue.Contains(5); Assert.IsTrue(existing); Assert.IsFalse(notExisting); }
public void CanRemoveData() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(7); queue.Enqueue(77); Assert.IsTrue(queue.Count == 2); queue.Dequeue(); Assert.IsTrue(queue.Count == 1); }
public void CanClearQueue() { Queue <int> queue = new LinearDataStructures.Queue <int>(); queue.Enqueue(7); queue.Enqueue(77); Assert.IsTrue(queue.Count == 2); queue.Clear(); // Default value of int Assert.IsTrue(queue.Peek() == 0); }
public void OnInitialCreateQueueIsEmpty() { Queue <int> queue = new LinearDataStructures.Queue <int>(); Assert.IsTrue(queue.Count == 0); }