public void PushPop_stos1SieNieZmieniaLink() { stos1 = new StosLink <char>(); stos1.Push(RandomElement); stos1.Push(RandomElement); char[] tabPrzed = stos1.ToArray(); char e = RandomElement; stos1.Push(e); stos1.Pop(); char[] tabPo = stos1.ToArray(); CollectionAssert.AreEqual(tabPrzed, tabPo); }
public void stos1IEnumeratorCzyEnumerujeLink() { stos1 = new StosLink <char>(); stos1.Push(RandomElement); stos1.Push(RandomElement); stos1.Push(RandomElement); stos1.Push(RandomElement); char[] tab = stos1.ToArray(); int i = 0; var enumerator = stos1.ToArray().GetEnumerator(); while (enumerator.MoveNext()) { char s = (char)enumerator.Current; Assert.AreEqual(s, tab[i]); i++; } }
public void IndexerCzyZwracaOdpowiednielementLink() { stos1 = new StosLink <char>(); stos1.Push(RandomElement); stos1.Push(RandomElement); stos1.Push(RandomElement); stos1.Push(RandomElement); char[] tab = stos1.ToArray(); for (int i = 0; i < 4; i++) { Assert.AreEqual(stos1[i], tab[i]); } }