Ejemplo n.º 1
0
        public void initiliseNewBoard()
        {
            Board board = new Board();

            //Checks for empty board
            Assert.AreEqual("|", board.getPlayerPieces());

            //Checks all the cells are empty
            Cell[,] cells = board.getCells();
            foreach (Cell cell in cells)
            {
                Assert.AreEqual(Piece.EMPTY, cell.getPiece());
            }
        }
Ejemplo n.º 2
0
Archivo: Program.cs Proyecto: bdr27/c-
 static void Main(string[] args)
 {
     MessageHandler handler = new MOCKMessageHandler();
     string menu = "1. Test ConnectTo()\n2. Test SendRequest\n3. Test Board Setup\n4. (Q)uit";
     Console.WriteLine(menu);
     string choice = Console.ReadLine();
     while (!choice.ToLower().Equals("q"))
     {
         string response = "";
         switch (choice)
         {
             case "1":
                 Console.Write("IP Address: ");
                 string ipAddress = Console.ReadLine();
                 Console.Write("Port Number: ");
                 int portNumber = Int32.Parse(Console.ReadLine());
                 handler.connectTo(ipAddress, portNumber);
                 response = handler.getResponse();
                 break;
             case "2":
                 Console.Write("Request: ");
                 string request = Console.ReadLine();
                 handler.sendRequest(request);
                 response = handler.getResponse();
                 Console.WriteLine(response);
                 break;
                 case "3":
                 Console.WriteLine("Board setup test");
                 Board board = new Board();
                 board.setupStartingLocations();
                 Console.WriteLine(board.getPlayerPieces());                            
                 break;
             default:
                 Console.WriteLine("Invalid Option");
                 break;
         }
         Console.WriteLine("Response: " + response);
         Console.WriteLine(menu);
         choice = Console.ReadLine();
     }
     Console.WriteLine("Thank you for testing");
     Console.ReadKey();
 }
Ejemplo n.º 3
0
 public void testSettingUpPlayers()
 {
     Board board = new Board();
     board.setupStartingLocations();
     Assert.AreEqual("N12N14N16N18N21N23N25N27N32N34N36N38|N61N63N65N67N72N74N76N78N81N83N85N87", board.getPlayerPieces());
 }