示例#1
0
        public void AddObjectTest()
        {
            IField lab = new Labyrinth(7);
            GameObject obj = new GameObject('$', 3, 3);
            lab.AddObject(obj);

            var expected = '$';
            var actual = lab[3, 3];

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void AddObjectFailTest()
        {
            Labyrinth lab = new Labyrinth(7);
            GameObject obj = new GameObject('$', 0, 1);

            char[,] testMatrix = new char[,] {
                 {'-', 'X', '-', 'X'},
                 {'-', '-', '-', 'X'},
                 {'X', 'X', '-', '-'} ,
                 {'X', 'X', '-', '-'}
            };

            lab.TestMatrix(testMatrix);
            lab.AddObject(obj);

            var expected = 'X';
            var actual = lab[0, 1];

            Assert.AreEqual(expected, actual);
        }
示例#3
0
 /// <summary>
 /// Move object Player in to tha labyrinth
 /// </summary>
 /// <param name="gameObject">Player instance</param>
 public void AddObject(GameObject gameObject)
 {
     if (this.matrix[gameObject.Row, gameObject.Col] != BlockedCellSymbol)
     {
         this.matrix[gameObject.Row, gameObject.Col] = gameObject.Symbol;
     }
     else
     {
         Console.WriteLine("Invalid move");
     }
 }