示例#1
0
        public void to_country_owned_by_player()
        {
            var command = new Commands.Deploy(
                Belgium,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
                .WithMessage(ValidationMessage.Error("Country Belgium must be owned by P1."));
        }
示例#2
0
        public void with_army_that_not_exceeds_available()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P1.Army(4),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
                .WithMessage(ValidationMessage.Error("Action not be executed as it requires more armies (P1.Army(4)) then available (P1.Army(3))."));
        }
示例#3
0
        public void to_existing_country()
        {
            var command = new Commands.Deploy(
                Unknown,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
                .WithMessage(ValidationMessage.Error("Country with id 666 does not exist."));
        }
示例#4
0
        public void by_active_player()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P2.Army(3),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
                .WithMessage(ValidationMessage.Error("Action can only be applied by the active P1, not by P2."));
        }
示例#5
0
        public void in_deploy_phase()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 5);

            Handle(command, Benelux().Deploy()).Should().BeInvalid()
                .WithMessage(ValidationMessage.Error("Action must be in the Deploy phase to be executed, not in the Attack phase."));
        }
示例#6
0
        public void Can_only_be_applied_on_own_country()
        {
            var command = new Commands.Deploy(
                Luxembourg,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
            .WithMessage(ValidationMessage.Error("Country Luxembourg must be owned by P1."));
        }
示例#7
0
        public void Can_be_applied_by_active_player()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeValid()
            .Value.Countries.ById(Netherlands).Army.Should().Be(Player.P1.Army(6));
        }
示例#8
0
        public void and_moves_to_attack_phase_when_out_deployments()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P1.Army(3),
                GameId,
                ExpectedVersion: 4);

            var game = Handle(command, Benelux()).Should().BeValid().Value;

            game.Countries.ById(Netherlands).Army.Should().Be(Player.P1.Army(6));
            game.ArmyBuffer.Should().Be(Army.None);
            game.Phase.Should().Be(GamePhase.Attack);
        }
示例#9
0
        public void and_stays_in_deploy_phase_when_deployment_left()
        {
            var command = new Commands.Deploy(
                Netherlands,
                Player.P1.Army(2),
                GameId,
                ExpectedVersion: 4);

            var game = Handle(command, Benelux()).Should().BeValid().Value;

            game.Countries.ById(Netherlands).Army.Should().Be(Player.P1.Army(5));
            game.ArmyBuffer.Should().Be(Player.P1.Army(1));
            game.Phase.Should().Be(GamePhase.Deploy);
        }