Beispiel #1
0
            public void run()
            {
                BoggleServer.BoggleServer server = new BoggleServer.BoggleServer(1, "..\\..\\customDic.txt", sixteenAs);

                BoggleConnection conn = new BoggleConnection("localhost", "p1");

                conn.GameStarted  += gameStarted;
                conn.ScoreChanged += scoreChanged1;
                conn.TimeChanged  += timechanged1;
                conn.GameEnded    += gameEnded1;
                conn.Connect();

                BoggleConnection conn2 = new BoggleConnection("localhost", "p2");

                conn2.GameStarted  += gameStarted2;
                conn2.ScoreChanged += scoreChanged2;
                conn2.GameEnded    += gameEnded2;
                conn2.Connect();

                Thread.Sleep(1200);

                Assert.AreEqual("P2", p1Op);
                Assert.AreEqual("P1", p2Op);
                Assert.AreEqual(sixteenAs, p1Letters);
                Assert.AreEqual(sixteenAs, p2Letters);
                Assert.AreEqual("1 0", p1score1);
                Assert.AreEqual("0 1", p2score1);
                Thread.Sleep(1000);
                Assert.AreEqual("1 AAA 0  0  0  0", p1Summary);
                Assert.AreEqual("0  1 AAA 0  0  0", p2Summary);

                server.Close();
            }
Beispiel #2
0
            public void run()
            {
                BoggleServer.BoggleServer server = new BoggleServer.BoggleServer(3, "..\\..\\customDic.txt", BoardLetters);
                BoggleConnection          conn1  = new BoggleConnection("localhost", "P1");
                BoggleConnection          conn2  = new BoggleConnection("localhost", "P2");

                conn1.ServerLost += p1LostServer;
                conn2.ServerLost += p2LostServer;

                conn1.Connect();
                conn2.Connect();

                Thread.Sleep(1000);
                server.Close();

                while (!p1Lost && !p2Lost)
                {
                    Thread.Sleep(10);
                }

                Assert.AreEqual(true, p1Lost);
                Assert.AreEqual(true, p2Lost);

                server.Close();
            }
Beispiel #3
0
        /// <summary>
        /// Notifies the server that player is ready to play. Loads in custom clock font.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameForm_Load(object sender, EventArgs e)
        {
            conn.Connect();
            PrivateFontCollection pfc = new PrivateFontCollection();

            pfc.AddFontFile("..\\..\\..\\DS-DIGI.ttf");
            TimeLabel.Font = new Font(pfc.Families[0], 45, FontStyle.Regular);
        }
Beispiel #4
0
            public void run()
            {
                BoggleServer.BoggleServer server = new BoggleServer.BoggleServer(1, "..\\..\\customDic.txt", BoardLetters);
                BoggleConnection          P1conn = new BoggleConnection("localhost", "p1");

                P1conn.GameTerminated += p1terminated;
                P1conn.Connect();

                BoggleConnection P2conn = new BoggleConnection("localhost", "p2");

                P2conn.GameTerminated += p2terminated;
                P2conn.Connect();

                Thread.Sleep(100);
                P1conn.Disconnect();
                Thread.Sleep(1000);

                Assert.AreEqual(false, p1ReceivedTERMINATED);
                Assert.AreEqual(true, p2ReceivedTERMINATED);

                server.Close();
            }