public void testMoveUnitOneSektor() { // Testfall: Bewegung um einen Sektor DummyUnit testUnit = new DummyUnit(666); ; string startPos = "0"; string targetPos = "1"; Sektor targetSektor = testEngine.FieldField.get(targetPos); testEngine.FieldField.get(startPos).addUnit(testUnit); Assert.AreEqual(startPos, testEngine.getSektorContainingUnit(testUnit).ListUnits.IndexOf(testUnit)); List<Move> possibleMoves = testEngine.getDefaultMoveCommandsForUnit(testUnit); Move commandToTest = null; foreach (Move m in possibleMoves) { if (m.TargetSektor == targetSektor) { commandToTest = m; break; } } commandToTest.Execute(); Sektor newPosition = testEngine.getSektorContainingUnit(testUnit); Assert.AreEqual(targetSektor, newPosition); }
public void addUnitTest() { int unitCount = sektorTest.ListUnits.Count; DummyUnit testUnit = new DummyUnit(667); sektorTest.addUnit(testUnit); Assert.AreEqual(unitCount + 1, sektorTest.ListUnits.Count); }
public void testGetUnitOwner() { DummyUnit testUnit = new DummyUnit(999); testEngine.ListPlayers[0].ListUnits.Add(testUnit); Player owner = testEngine.getUnitOwner(testUnit); Assert.AreEqual(testEngine.ListPlayers[0], owner); }
public void UnitEnteredSektorEventTest() { bool eventFired = false; sektorTest.onUnitEnteredSektor += delegate(object sender, SektorEventArgs args){ eventFired = true; }; DummyUnit testUnit = new DummyUnit(669); sektorTest.addUnit(testUnit); Assert.AreEqual(true, eventFired); }
public void removeUnitTest() { DummyUnit testUnit = new DummyUnit(668); sektorTest.addUnit(testUnit); int unitCount = sektorTest.ListUnits.Count; sektorTest.removeUnit(testUnit); Assert.AreEqual(unitCount - 1, sektorTest.ListUnits.Count); }