public void TestEnumerator() { List <Phase> list = new List <Phase>(); list.Add(new PhaseSimple(0)); list.Add(new PhaseSimple(1)); list.Add(new PhaseSimple(2)); list.Add(new PhaseSimple(3)); list.Add(new PhaseSimple(4)); PhaseList ls = new PhaseList(); ls.add(list[0]); ls.add(list[1]); ls.add(list[2]); ls.add(list[3]); ls.add(list[4]); int i = 0; foreach (Phase p in ls) { Assert.AreEqual(list[i], p); i++; } }
public void TestAddPop() { PhaseList ls = new PhaseList(); ls.add(new PhaseSimple(0)); ls.add(new PhaseSimple(1)); ls.add(new PhaseSimple(2)); ls.add(new PhaseSimple(3)); ls.add(new PhaseSimple(4)); Assert.AreEqual(ls.pop().playerID, 0); Assert.AreEqual(ls.pop().playerID, 1); Assert.AreEqual(ls.pop().playerID, 2); Assert.AreEqual(ls.pop().playerID, 3); Assert.AreEqual(ls.pop().playerID, 4); Assert.IsTrue(ls.isEmpty()); }
public void phaselistenum() { PhaseList p = new PhaseList(); p.add(new ActionPhase(new ZhangFei(1))); Assert.IsInstanceOfType(p.GetEnumerator(), typeof(IEnumerator <Phase>)); }
public void processUserInputTest() { MockRepository mocks = new MockRepository(); mocks.Stub <UserAction>(); Game g = new Game(players, cardList); Type stage = typeof(Game); FieldInfo stinfo = stage.GetField("stages", BindingFlags.NonPublic | BindingFlags.Instance); PhaseList p = new PhaseList(); p.add(new DiscardPhase(players[0])); p.add(new DiscardPhase(players[0])); stinfo.SetValue(g, p); g.processUserInput(0, mocks.Stub <UserAction>()); }
public void TestPushOneStageList() { PhaseList ls = new PhaseList(); ls.add(new PhaseSimple(0)); Assert.AreEqual(ls.pop().playerID, 0); Assert.IsTrue(ls.isEmpty()); }
public void TestPushStageList() { PhaseList ls = new PhaseList(); ls.add(new PhaseSimple(0)); ls.add(new PhaseSimple(1)); ls.add(new PhaseSimple(2)); PhaseList ls2 = new PhaseList(); ls2.add(new PhaseSimple(3)); ls2.add(new PhaseSimple(4)); ls.pushList(ls2); Assert.AreEqual(ls.pop().playerID, 3); Assert.AreEqual(ls.pop().playerID, 4); Assert.AreEqual(ls.pop().playerID, 0); Assert.AreEqual(ls.pop().playerID, 1); Assert.AreEqual(ls.pop().playerID, 2); }