public void Test6() { // ARRANGE var seq = new Stack <int>(); int int1 = DataGenerator.RandomInteger(); int int2 = DataGenerator.RandomInteger(); int int3 = DataGenerator.RandomInteger(); int int4 = DataGenerator.RandomInteger(); int int5 = DataGenerator.RandomInteger(); int int6 = DataGenerator.RandomInteger(); seq.Push(int1); seq.Push(int2); seq.Push(int3); seq.Push(int4); seq.Push(int5); seq.Push(int6); var q = new RepeatableStack <int>(seq); // ACT int rd1 = q.Pop(); int rd2 = q.Pop(); int rd3 = q.Pop(); var rr = q.Repeat(); var rr1 = rr.Pop(); var rr2 = rr.Pop(); var rr3 = rr.Pop(); var rq = q.Repeat(); var rq1 = rq.Pop(); var rq2 = rq.Pop(); var rq3 = rq.Pop(); // ASSERT Assert.Equal(int6, rd1); Assert.Equal(int6, rr1); Assert.Equal(int6, rq1); Assert.Equal(int5, rd2); Assert.Equal(int5, rr2); Assert.Equal(int5, rq2); Assert.Equal(int4, rd3); Assert.Equal(int4, rr3); Assert.Equal(int4, rq3); Assert.Equal(3, seq.Count); Assert.Contains(int1, seq); Assert.Contains(int2, seq); Assert.Contains(int3, seq); }
public void Test5() { // ARRANGE var seq = new GlobalCollectionsGeneric.List <int>(); int int1 = DataGenerator.RandomInteger(); int int2 = DataGenerator.RandomInteger(); int int3 = DataGenerator.RandomInteger(); int int4 = DataGenerator.RandomInteger(); int int5 = DataGenerator.RandomInteger(); int int6 = DataGenerator.RandomInteger(); seq.Add(int1); seq.Add(int2); seq.Add(int3); seq.Add(int4); seq.Add(int5); seq.Add(int6); var q = new RepeatableStack <int>(seq); // ACT int rd1 = q.Pop(); int rd2 = q.Pop(); int rd3 = q.Pop(); var rr = q.Repeat(); var rr1 = rr.Pop(); var rr2 = rr.Pop(); var rr3 = rr.Pop(); var rq = q.Repeat(); var rq1 = rq.Pop(); var rq2 = rq.Pop(); var rq3 = rq.Pop(); // ASSERT Assert.Equal(int6, rd1); Assert.Equal(int6, rr1); Assert.Equal(int6, rq1); Assert.Equal(int5, rd2); Assert.Equal(int5, rr2); Assert.Equal(int5, rq2); Assert.Equal(int4, rd3); Assert.Equal(int4, rr3); Assert.Equal(int4, rq3); }