Exemple #1
0
    public void TestMovementParam(Pos source, Pos dest)
    {
        var manager = new ArmyManager();
        var player  = new Player(manager, new Color(0, 0, 0));
        var army    = new Army(100);

        player.AddArmy(army, source);
        manager.MoveArmy(army, dest);

        Assert.IsTrue((manager.ArmyAt(source) != null) == source.Equals(dest)); // source != dest implies that army will no longer be at source.
        Assert.AreSame(army, manager.ArmyAt(dest));
        Assert.AreEqual(dest, manager.ArmyPosition(army));
    }
Exemple #2
0
    public void TestIllegalMovementParam(Pos source, Pos dest)
    {
        var manager = new ArmyManager();
        var player  = new Player(manager, new Color(0, 0, 0));
        var army    = new Army(100);

        player.AddArmy(army, source);
        manager.MoveArmy(army, dest);

        Assert.IsNull(manager.ArmyAt(dest));
        Assert.AreSame(army, manager.ArmyAt(source));
        Assert.AreEqual(source, manager.ArmyPosition(army));
    }
Exemple #3
0
    public void TestInitialAdd()
    {
        var manager = new ArmyManager();
        var player  = new Player(manager, new Color(0, 0, 0));

        player.AddArmy(new Army(100), new Pos(1, 1));

        Assert.AreEqual(1, player.ArmyList.Count);
        Assert.AreEqual(new Pos(1, 1), manager.ArmyPosition(player.ArmyList[0]));
        Assert.AreEqual(player.ArmyList[0], manager.ArmyAt(new Pos(1, 1)));
    }