public void TestGetPoints() { ITile[] neighbours = new ITile[4] { new Lowland(), new Lowland(), new Lowland(), new Lowland() }; Assert.AreEqual(1, viking.GetPoints(new Forest(), neighbours)); Assert.AreEqual(0, viking.GetPoints(new Sea(), neighbours)); Assert.AreEqual(1, viking.GetPoints(new Lowland(), neighbours)); // Vikings have one more point if they are next the sea: neighbours[0] = new Sea(); neighbours[1] = new Sea(); Assert.AreEqual(2, viking.GetPoints(new Lowland(), neighbours)); Assert.AreEqual(1, viking.GetPoints(new Desert(), neighbours)); Assert.AreEqual(2, viking.GetPoints(new Mountain(), neighbours)); }
private void TestStartPlayer(int size) { int[][] map = Wrapper.generateMapList(size); int[][] starts = Wrapper.getStartsPlayers(map, size); int seaNumber = new Sea().Number; Assert.AreEqual(2, starts.Length); Assert.AreEqual(2, starts[0].Length); for(int i=0; i<2; i++) { for(int j=0; j<2; j++) { Assert.IsTrue(starts[i][j] >= 0); Assert.IsTrue(starts[i][j] < size); } Assert.IsTrue(map[starts[i][0]][starts[i][1]] != seaNumber); } }
public void TestStartsPlayer() { this.TestStartPlayer(5); this.TestStartPlayer(10); this.TestStartPlayer(15); int sea = new Sea().Number; int forest = new Forest().Number; int[][] map = new int[][] { new int[5] {sea, sea, sea, sea, sea}, new int[5] {sea, sea, sea, sea, sea}, new int[5] {sea, sea, forest, forest, sea}, new int[5] {sea, sea, sea, forest, sea}, new int[5] {sea, sea, sea, sea, sea} }; int[][] starts = Wrapper.getStartsPlayers(map, 5); Assert.AreEqual(3, starts[0][0]); Assert.AreEqual(3, starts[0][1]); Assert.AreEqual(2, starts[1][0]); Assert.AreEqual(2, starts[1][1]); }