public void ValidTurnCausePlayerToBeEliminated() { TestScenerios test = new TestScenerios(); Tile t1 = test.makeTile(0, 1, 2, 4, 3, 6, 5, 7); Tile t2 = test.makeTile(0, 6, 1, 5, 2, 4, 3, 7); Tile t3 = test.makeTile(0, 5, 1, 4, 2, 7, 3, 6); List <Tile> drawpile = test.makeDrawPile(t2, t3); Admin a = test.createAdminWithDrawPile(drawpile); Board b = new Board(); SPlayer p1 = new SPlayer("p1", new List <Tile>()); Posn p1Pos = new Posn(0, 1, 6); test.setStartPos(b, p1, p1Pos); SPlayer p2 = new SPlayer("p2", new List <Tile>()); Posn p2Pos = new Posn(4, 4, 0); test.setStartPos(b, p2, p2Pos); a.addToActivePlayers(p1); a.addToActivePlayers(p2); TurnResult tmpturn = a.playATurn(b, t1); Assert.AreEqual(1, a.numEliminated(), "count of eliminated players has not increased to 1"); Assert.IsTrue(tmpturn.eliminatedPlayers.Count == 1, "count of eliminated players has not increased to 1"); Assert.IsTrue(tmpturn.eliminatedPlayers.Exists(x => x.getColor() == "p1"), "p1 has not been moved to eliminated players"); Assert.IsFalse(tmpturn.currentPlayers.Exists(x => x.getColor() == "p1"), "p1 has not been removed from current players"); Assert.IsTrue(tmpturn.currentPlayers.Count == 1, "count of current players has not decreased to 1"); }
public void PlayAValidTurnChangesOrderOfInGamePlayers() { TestScenerios test = new TestScenerios(); Tile t1 = test.makeTile(0, 1, 2, 4, 3, 6, 5, 7); Tile t2 = test.makeTile(0, 6, 1, 5, 2, 4, 3, 7); Tile t3 = test.makeTile(0, 5, 1, 4, 2, 7, 3, 6); List <Tile> drawpile = test.makeDrawPile(t2, t3); Admin a = test.createAdminWithDrawPile(drawpile); Board b = new Board(); SPlayer p1 = new SPlayer("blue", new List <Tile>()); Posn p1Pos = new Posn(0, 0, 3); SPlayer p2 = new SPlayer("green", new List <Tile>()); Posn p2Pos = new Posn(4, 4, 0); a.addToActivePlayers(p1); a.addToActivePlayers(p2); b.addPlayerToBoard("blue", p1Pos); b.addPlayerToBoard("green", p2Pos); List <SPlayer> l1 = new List <SPlayer>() { p1, p2 }; List <SPlayer> l2 = new List <SPlayer>(); TurnResult tmpturn = a.playATurn(b, t1); Assert.IsTrue(tmpturn.currentPlayers[0].getColor() == "green"); Assert.IsTrue(tmpturn.currentPlayers[1].getColor() == "blue"); Assert.IsTrue(tmpturn.currentPlayers.Count == 2); }
public void PlayAValidTurnRemovesTileFromDrawPile() { TestScenerios test = new TestScenerios(); Tile t1 = test.makeTile(0, 1, 2, 4, 3, 6, 5, 7); Tile t2 = test.makeTile(0, 6, 1, 5, 2, 4, 3, 7); Tile t3 = test.makeTile(0, 5, 1, 4, 2, 7, 3, 6); List <Tile> drawpile = test.makeDrawPile(t2, t3); Admin a = test.createAdminWithDrawPile(drawpile); Board b = new Board(); SPlayer p1 = new SPlayer("blue", new List <Tile>()); Posn p1Pos = new Posn(0, 0, 3); b.addPlayerToBoard(p1.getColor(), p1Pos); SPlayer p2 = new SPlayer("hotpink", new List <Tile>()); Posn p2Pos = new Posn(4, 4, 0); b.addPlayerToBoard(p2.getColor(), p2Pos); a.addToActivePlayers(p1); a.addToActivePlayers(p2); List <SPlayer> l1 = new List <SPlayer>() { p1, p2 }; List <SPlayer> l2 = new List <SPlayer>(); TurnResult tmpturn = a.playATurn(b, t1); Assert.AreEqual(1, tmpturn.drawPile.Count); Assert.IsFalse(tmpturn.drawPile.Exists(x => x.isEqualOrRotation(t2))); List <Tile> hand = tmpturn.currentPlayers[1].getHand(); Assert.IsTrue(hand.Exists(x => x.isEqualOrRotation(t2))); }
public void PlayAValidTurnRemovesTileFromDrawPile() { TestScenerios test = new TestScenerios(); Tile t1 = test.makeTile(0, 1, 2, 4, 3, 6, 5, 7); Tile t2 = test.makeTile(0, 6, 1, 5, 2, 4, 3, 7); Tile t3 = test.makeTile(0, 5, 1, 4, 2, 7, 3, 6); Admin a = new Admin(); List <Tile> drawpile = test.makeDrawPile(t2, t3); Board b = test.createBoardWithDrawPile(drawpile); SPlayer p1 = new SPlayer("p1", new List <Tile>()); Posn p1Pos = new Posn(0, 0, 3); p1.setPosn(p1Pos); SPlayer p2 = new SPlayer("p2", new List <Tile>()); Posn p2Pos = new Posn(4, 4, 0); p2.setPosn(p2Pos); b.registerPlayer(p1); b.registerPlayer(p2); List <SPlayer> l1 = new List <SPlayer>() { p1, p2 }; List <SPlayer> l2 = new List <SPlayer>(); TurnResult tmpturn = a.playATurn(b, t1); Assert.AreEqual(1, tmpturn.drawPile.Count); Assert.IsFalse(tmpturn.drawPile.Exists(x => x.isEqual(t2))); List <Tile> hand = tmpturn.currentPlayers[1].returnHand(); Assert.IsTrue(hand.Exists(x => x.isEqual(t2))); }
public void PlayAValidTurnChangesOrderOfInGamePlayers() { TestScenerios test = new TestScenerios(); Tile t1 = test.makeTile(0, 1, 2, 4, 3, 6, 5, 7); Tile t2 = test.makeTile(0, 6, 1, 5, 2, 4, 3, 7); Tile t3 = test.makeTile(0, 5, 1, 4, 2, 7, 3, 6); Admin a = new Admin(); List <Tile> drawpile = test.makeDrawPile(t2, t3); Board b = test.createBoardWithDrawPile(drawpile); SPlayer p1 = new SPlayer("p1", new List <Tile>()); Posn p1Pos = new Posn(0, 0, 3); p1.setPosn(p1Pos); SPlayer p2 = new SPlayer("p2", new List <Tile>()); Posn p2Pos = new Posn(4, 4, 0); p2.setPosn(p2Pos); b.registerPlayer(p1); b.registerPlayer(p2); List <SPlayer> l1 = new List <SPlayer>() { p1, p2 }; List <SPlayer> l2 = new List <SPlayer>(); TurnResult tmpturn = a.playATurn(b, t1); Assert.IsTrue(tmpturn.currentPlayers[0].returnColor() == "p2"); Assert.IsTrue(tmpturn.currentPlayers[1].returnColor() == "p1"); Assert.IsTrue(tmpturn.currentPlayers.Count == 2); }