public void TestBuggyRoad() { Catan catan_test = new Catan(0); Player jon = new Player("Jon"); Player arya = new Player("Arya"); catan_test.AddPlayer(jon); catan_test.AddPlayer(arya); bool settl_placed = catan_test.SettlementClicked(new Point(4, 3), jon); bool road_placed = catan_test.RoadClicked(new Line(new Point(4, 3), new Point(5, 3)), jon); Assert.IsTrue(settl_placed, "Expected settlement to have been placed"); Assert.IsTrue(road_placed, "Expected setup road 1 jon to have been placed"); settl_placed = catan_test.SettlementClicked(new Point(3, 4), arya); road_placed = catan_test.RoadClicked(new Line(new Point(3, 4), new Point(4, 4)), arya); Assert.IsTrue(settl_placed, "Expected settlement to have been placed"); Assert.IsTrue(road_placed, "Expected setup road 1 arya to have been placed"); settl_placed = catan_test.SettlementClicked(new Point(5, 2), arya); road_placed = catan_test.RoadClicked(new Line(new Point(5, 2), new Point(5, 1)), arya); Assert.IsTrue(settl_placed, "Expected settlement to have been placed"); Assert.IsTrue(road_placed, "Expected setup road 2 arya to have been placed"); settl_placed = catan_test.SettlementClicked(new Point(7, 4), jon); road_placed = catan_test.RoadClicked(new Line(new Point(7, 4), new Point(6, 4)), jon); Assert.IsTrue(settl_placed, "Expected settlement to have been placed"); Assert.IsTrue(road_placed, "Expected setup road 2 jon to have been placed"); for (int i = 0; i < 4; i++) { jon.AddResource("brick"); jon.AddResource("wood"); jon.AddResource("wheat"); jon.AddResource("sheep"); } catan_test.RoadClicked(new Line(new Point(6, 4), new Point(5, 4)), jon); Assert.IsTrue(road_placed, "Expected road to have been placed"); Console.WriteLine("Placing final settlement"); settl_placed = catan_test.SettlementClicked(new Point(5, 4), jon); Assert.IsTrue(settl_placed, "Expected test settlement jon to have been placed"); }
public void TestAddPlayer() { Catan catan_test = new Catan(); catan_test.AddPlayer("Jorah"); catan_test.AddPlayer("Selmy"); Assert.IsTrue(catan_test.Players.Contains(new Player("Jorah"))); Assert.IsTrue(catan_test.Players.Contains(new Player("Selmy"))); Assert.IsFalse(catan_test.Players.Contains(new Player("Ulfric"))); Assert.IsTrue(catan_test.Players[0].Name == "Jorah"); Assert.IsTrue(catan_test.Players[1].Name == "Selmy"); }
public void TestCollectResource() { Catan catan_test = new Catan(0); Player jon = new Player("Jon"); catan_test.AddPlayer(jon); // give jon resources to be able to build for (int i = 0; i < 7; i++) { jon.AddResource("wood"); jon.AddResource("brick"); jon.AddResource("sheep"); jon.AddResource("wheat"); jon.AddResource("ore"); } catan_test.SettlementClicked(new Point(3, 1), jon); catan_test.SettlementClicked(new Point(5, 3), jon); catan_test.CollectResources(1, 2); catan_test.CollectResources(5, 3); catan_test.CollectResources(5, 6); Dictionary <string, int> jon_res = PlayerResourceCounts(jon); // Check resource counts Assert.AreEqual(8, jon_res["ore"], "Expected 8 ore"); Assert.AreEqual(8, jon_res["brick"], "Expected 8 brick"); Assert.AreEqual(10, jon_res["wood"], "Expected 10 wood"); Assert.AreEqual(8, jon_res["sheep"], "Expected 8 sheep"); Assert.AreEqual(9, jon_res["wheat"], "Expected 9 wheat"); }