public static void Main(string[] args) { CustomQueue<int> queue = new CustomQueue<int>(); queue.Add(5); queue.Add(55); queue.Add(96); queue.Add(123); queue.Add(234); while (queue.Count > 0) { Console.WriteLine(queue.Dequeue()); } }
public void GeneralFunctionalityWithPointEquatable() { CustomQueue <Point> customQueue = new CustomQueue <Point>(); customQueue.Add(new Point(2, 4)); customQueue.Add(new Point(1, 8)); Assert.AreEqual(customQueue, new[] { new Point(2, 4), new Point(1, 8) }); customQueue.Get(); Assert.AreEqual(customQueue, new[] { new Point(1, 8) }); Assert.AreEqual(customQueue.Peek(), new Point(1, 8)); Assert.AreEqual(customQueue.Count, 1); Assert.IsTrue(customQueue.Contains(new Point(1, 8))); Assert.IsFalse(customQueue.Contains(new Point(2, 4))); }
public void GeneralFunctionalityBCLTypesInt() { CustomQueue <int> customQueue = new CustomQueue <int>(); customQueue.Add(5); customQueue.Add(15); Assert.AreEqual(customQueue, new[] { 5, 15 }); customQueue.Get(); Assert.AreEqual(customQueue, new[] { 15 }); Assert.AreEqual(customQueue.Peek(), 15); Assert.AreEqual(customQueue.Count, 1); Assert.IsTrue(customQueue.Contains(15)); Assert.IsFalse(customQueue.Contains(5)); }
public void TestAddInCustomQue() { //Arrange customQueue.Add(1); customQueue.Add(2); int expected = 2; //Act var result = customQueue.Count; //Assert Assert.Equal(expected, result); }
public void GeneralFunctionalityWithArrayList() { CustomQueue <ArrayList> customQueue = new CustomQueue <ArrayList>(); customQueue.Add(new ArrayList() { 2 }); customQueue.Add(new ArrayList() { "Hello" }); Assert.AreEqual(customQueue, new[] { new ArrayList() { 2 }, new ArrayList() { "Hello" } }); customQueue.Get(); Assert.AreEqual(customQueue, new[] { new ArrayList() { "Hello" } }); Assert.AreEqual(customQueue.Peek(), new ArrayList() { "Hello" }); Assert.AreEqual(customQueue.Count, 1); Assert.IsFalse(customQueue.Contains(new ArrayList() { "Hello" })); Assert.IsFalse(customQueue.Contains(new ArrayList() { 2 })); }
static void Main(string[] args) { // LinkedLIsts<int> Lists = new LinkedLIsts<int>(); // Lists.Add(12); // Lists.Add(6); // Lists.Add(64); // Lists.Add(124); // Lists.Add(256); // Lists.Add(512); // Lists.Add(1084); // // System.Console.WriteLine(Lists.Size() + " Lists Size"); // Lists.GetChain(); // Lists.Remove(0); CustomQueue <int> Queuery = new CustomQueue <int>(); Queuery.Add(14); Queuery.Add(18); Queuery.Add(19); Queuery.Add(20); Queuery.Add(21); Queuery.Remove(); StackBasedOnArray <int> StackOnArray = new StackBasedOnArray <int>(); StackOnArray.Push(15); StackOnArray.Push(20); StackOnArray.Push(25); StackOnArray.Pop(); StackOnArray.Pop(); StackOnArray.Push(30); StackOnArray.Push(35); Deque <int> DeDeque = new Deque <int>(); DeDeque.Push(15); DeDeque.Push(20); DeDeque.Push(25); // get initial size: // System.Console.WriteLine(DeDeque.DequeSize() + " size start"); // should be return * 15 * // System.Console.WriteLine(DeDeque.TakeFirst()); // remove one: // DeDeque.Pop(); // should be return * 15 * // System.Console.WriteLine(DeDeque.TakeFirst()); // Shift method testing... DeDeque.Shift(11); DeDeque.Push(30); DeDeque.Shift(7); DeDeque.Pop(); System.Console.WriteLine(DeDeque.TakeLast()); // should be return * 11 * // System.Console.WriteLine(DeDeque.TakeFirst()); System.Console.WriteLine(DeDeque.DequeSize() + " size start"); System.Console.WriteLine(DeDeque.TakeFirst()); DeDeque.Unshift(); System.Console.WriteLine(DeDeque.TakeFirst()); System.Console.WriteLine(DeDeque.DequeSize() + " size FINISH"); DeDeque.Shift(173); System.Console.WriteLine(DeDeque.TakeFirst()); DeDeque.Push(190); System.Console.WriteLine(DeDeque.TakeFirst()); System.Console.WriteLine(DeDeque.TakeLast()); // get updated size: * 3 * // System.Console.WriteLine(DeDeque.DequeSize() + " size finish"); }
public void QueueAddTest(CustomQueue <int> input, CustomQueue <int> expected, int addElement) { input.Add(addElement); Assert.AreEqual(expected.QueueList, input.QueueList); }
public void AddItemToQueue() { Sut.Add("Can"); Sut.Add("Sergen"); Sut.Add("Emre"); Sut.Add("Hami"); Sut.Add("Gamze"); Assert.AreEqual(5, Sut.GetItemCount()); }