Пример #1
0
        public void ConstructorTest_ValidInput()
        {
            GameState  gs     = getState();
            Vector2    pos    = new Vector2(3, 1);
            Vector2    target = new Vector2(2, 2);
            GhostState state  = GhostState.Chasing;

            PacmanLibrary.Enums.Color c = PacmanLibrary.Enums.Color.Red;
            Ghost ghost = new Ghost(gs, 3, 1, target, state, c);

            bool expected = true;
            bool actual   = true;

            if (ghost.ghostColor != c)
            {
                actual = false;
            }
            if (ghost.Position != pos)
            {
                actual = false;
            }
            if (ghost.CurrentState != GhostState.Chasing)
            {
                actual = false;
            }
            if (ghost.Points != 200)
            {
                actual = false;
            }

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void ColorPropertyTestGet()
        {
            Ghost ghost = getGhost();

            PacmanLibrary.Enums.Color expected = PacmanLibrary.Enums.Color.Red;
            PacmanLibrary.Enums.Color actual   = ghost.ghostColor;
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void ConstructorTest_InvalidInputNegativePosition()
        {
            GameState  gs     = null;
            Vector2    target = new Vector2(2, 2);
            GhostState state  = GhostState.Chasing;

            PacmanLibrary.Enums.Color c = PacmanLibrary.Enums.Color.Red;
            Ghost ghost = new Ghost(gs, -3, 1, target, state, c);
        }
Пример #4
0
        public Ghost getGhost()
        {
            GameState gs = getState();

            PacmanLibrary.Tile tile = new PacmanLibrary.Structure.Path(3, 3, null);
            gs.Pen.AddTile(tile);
            Vector2    pos    = new Vector2(3, 1);
            Vector2    target = new Vector2(2, 2);
            GhostState state  = GhostState.Chasing;

            PacmanLibrary.Enums.Color c = PacmanLibrary.Enums.Color.Red;
            Ghost ghost = new Ghost(gs, 3, 1, target, state, c);

            return(ghost);
        }