예제 #1
0
        public void HaveCompteur_ShouldKeepIt()
        {
            var world = AWorld.WithOnePlayerAt(11, 9);
            world.Initialize();

            var simulator = new WorldSimulator(world);

            ACompteur.Is(world.Compteurs[0], 9, 9);
            ACompteur.Is(world.Compteurs[1], 11, 9);
            Assert.Equal(1, world.Players[0].CompteurId);

            world = simulator.ApplyAction(0, Direction.O);

            Assert.Equal(1, world.Players[0].CompteurId);
            ACompteur.Is(world.Compteurs[0], 9, 9);
            ACompteur.Is(world.Compteurs[1], 10, 9);

            world = simulator.ApplyAction(0, Direction.O);

            Assert.Equal(1, world.Players[0].CompteurId);
            ACompteur.Is(world.Compteurs[0], 9, 9);
            ACompteur.Is(world.Compteurs[1], 9, 9);

            world = simulator.ApplyAction(0, Direction.O);

            Assert.Equal(1, world.Players[0].CompteurId);
            ACompteur.Is(world.Compteurs[0], 9, 9);
            ACompteur.Is(world.Compteurs[1], 8, 9);

            world = simulator.ApplyAction(0, Direction.O);

            Assert.Equal(1, world.Players[0].CompteurId);
            ACompteur.Is(world.Compteurs[0], 9, 9);
            ACompteur.Is(world.Compteurs[1], 7, 9);
        }
예제 #2
0
        public void MoveOnCompteur_ShouldHasCompteur(int x, int y, Direction direction)
        {
            var world = AWorld.WithOnePlayerAt(x, y);
            Assert.False(world.Players[0].HasCompteur);

            var simulator = new WorldSimulator(world);
            var nworld = simulator.ApplyAction(0, direction);

            APlayer.Is(nworld.Players[0], 9, 9, 1, PlayerState.Playing);
            Assert.True(nworld.Players[0].HasCompteur);
        }
예제 #3
0
        public void BasicMove_ShouldSucceed(Direction direction, int x, int y)
        {
            var world = AWorld.WithOnePlayerAt(5, 7);
            var simulator = new WorldSimulator(world);
            var newWorld = simulator.ApplyAction(0, direction);

            Assert.NotNull(newWorld);
            Assert.Equal(1, newWorld.Players.Count);

            var player = newWorld.Players[0];
            APlayer.Is(player, x, y, 0, PlayerState.Playing);
        }
예제 #4
0
        public void MoveOnOtherCaddyWithCompteur_ShouldNotChangeScore(int x, int y, Direction direction)
        {
            var world = this.GivenWorld(x, y, x, y);

            APlayer.Is(world.Players[0], x, y, 0, PlayerState.Playing);
            Assert.True(world.Players[0].HasCompteur);

            var simulator = new WorldSimulator(world);
            var nworld = simulator.ApplyAction(0, direction);

            APlayer.Is(nworld.Players[0], 1, 3, 0, PlayerState.Playing);
            Assert.True(nworld.Players[0].HasCompteur);
        }
예제 #5
0
        public void MoveOnCompteur_ShouldIncreaseScore(int x, int y, Direction direction)
        {
            var world = this.GivenWorld(x, y, 9, 9);

            APlayer.Is(world.Players[0], x, y, 0, PlayerState.Playing);
            Assert.False(world.Players[0].HasCompteur);

            var simulator = new WorldSimulator(world);
            var nworld = simulator.ApplyAction(0, direction);

            APlayer.Is(nworld.Players[0], 9, 9, 1, PlayerState.Playing);
            Assert.True(nworld.Players[0].HasCompteur);
        }
예제 #6
0
        public void Move_ShouldNotChangeScore(int x, int y, Direction direction)
        {
            var world = this.GivenWorld(9, 9, 0, 0);

            APlayer.Is(world.Players[0], 9, 9, 0, PlayerState.Playing);
            ACompteur.Is(world.Compteurs[0], 0, 0);
            Assert.False(world.Players[0].HasCompteur);

            var simulator = new WorldSimulator(world);
            var nworld = simulator.ApplyAction(0, direction);

            APlayer.Is(nworld.Players[0], x, y, 0, PlayerState.Playing);
            ACompteur.Is(nworld.Compteurs[0], 0, 0);
            Assert.False(nworld.Players[0].HasCompteur);
        }
예제 #7
0
        public void MoveWithCompteur_ShouldHasCompteur(int x, int y, Direction direction)
        {
            var world = AWorld.WithOnePlayerAt(9, 9);
            world.Initialize();

            ACompteur.Is(world.Compteurs[0], 9, 9);
            Assert.True(world.Players[0].HasCompteur);

            var simulator = new WorldSimulator(world);
            var nworld = simulator.ApplyAction(0, direction);

            APlayer.Is(nworld.Players[0], x, y, 0, PlayerState.Playing);
            ACompteur.Is(nworld.Compteurs[0], x, y);
            Assert.True(nworld.Players[0].HasCompteur);
        }
예제 #8
0
        public void MovingOutOfBound_ShouldStunned(int x, int y, Direction direction)
        {
            var world = AWorld.WithOnePlayerAt(x, y);
            var simulator = new WorldSimulator(world);
            var newWorld = simulator.ApplyAction(0, direction);

            APlayer.Is(newWorld.Players[0], x, y, -5, PlayerState.Stunned);
        }