Exemplo n.º 1
0
        public void NetTest2()
        {
            Thread serverThread = new Thread(DoServerStuff);

            serverThread.Start();

            NetBreakoutPongClient.GameServer server = new NetBreakoutPongClient.GameServer();

            NetBreakoutPongClient.ClassicPongGameData resultData = server.GetData();

            NetBreakoutPongClient.ClassicPongGameData expectedData = new NetBreakoutPongClient.ClassicPongGameData();
            expectedData.gameBall.Position  = new NetBreakoutPongClient.Location(250, 300);
            expectedData.gameBall.Radius    = 50;
            expectedData.myPaddle.Height    = 40;
            expectedData.myPaddle.Width     = 150;
            expectedData.myPaddle.Position  = new NetBreakoutPongClient.Location(500, 580);
            expectedData.oppPaddle.Height   = 40;
            expectedData.oppPaddle.Width    = 150;
            expectedData.oppPaddle.Position = new NetBreakoutPongClient.Location(300, 20);

            serverThread.Join();
            server.Dispose();

            // Assert.AreEqual(false, resultData.WinnerPlayerOne); // Fix later.. maybe
        }
Exemplo n.º 2
0
        public void NetTest1()
        {
            Thread serverThread = new Thread(DoServerStuff);

            serverThread.Start();
            //now being a client
            NetBreakoutPongClient.GameServer server = new NetBreakoutPongClient.GameServer();

            NetBreakoutPongClient.ClassicPongGameData resultData = server.GetData();

            NetBreakoutPongClient.ClassicPongGameData expectedData = new NetBreakoutPongClient.ClassicPongGameData();
            expectedData.gameBall.Position  = new NetBreakoutPongClient.Location(250, 300);
            expectedData.gameBall.Radius    = 50;
            expectedData.myPaddle.Height    = 40;
            expectedData.myPaddle.Width     = 150;
            expectedData.myPaddle.Position  = new NetBreakoutPongClient.Location(500, 580);
            expectedData.oppPaddle.Height   = 40;
            expectedData.oppPaddle.Width    = 150;
            expectedData.oppPaddle.Position = new NetBreakoutPongClient.Location(300, 20);
            serverThread.Join();

            server.Dispose();

            Assert.AreEqual(expectedData.myPaddle.Position.X, resultData.myPaddle.Position.X);
        }