public void Enumerator_CollectionWasChanged_ExceptionExpected() { QueueN <int> q = new QueueN <int>(1); for (int i = 0; i < 10; i++) { q.Push(i); } Assert.Throws(typeof(InvalidOperationException), () => { foreach (var el in q) { q.Pop(); } }); Assert.Throws(typeof(InvalidOperationException), () => { foreach (var el in q) { q.Push(el); } }); }
public void Pop_ExceptionExpected() { //arrange QueueN <int> q = new QueueN <int>(2); //assert Assert.Throws(typeof(InvalidOperationException), () => q.Pop()); }
public void PushFrontPop_intArray_RightOrderOfElementsExpected (int[] data) { //arrange QueueN <int> q = new QueueN <int>(2); //act for (int i = 0; i < data.Length; i++) { q.Push(data[i]); } //assert for (int i = 0; i < data.Length; i++) { int actual = q.Front(); Assert.AreEqual(data[i], actual); q.Pop(); } Assert.AreEqual(true, q.Empty, "queue is not empty, but should be"); }