Ejemplo n.º 1
0
            /// <summary>
            /// Helper test method
            /// </summary>
            public void run()
            {
                try
                {
                    //setup server
                    server = new BoggleServer(80, "dictionary.txt");

                    //setup clients
                    BoggleClientModel target    = new BoggleClientModel();
                    string            IPAddress = "127.0.0.1";
                    string            name      = "test";

                    BoggleClientModel target2 = new BoggleClientModel();
                    string            name2   = "test2";

                    target.IncomingStartEvent += delegate(string line)
                    {
                        MRE.Set();
                    };


                    target2.IncomingTerminatedEvent += delegate(string line)
                    {
                        MRE1.Set();
                    };

                    //connect the clients
                    target.Connect(IPAddress, name);
                    target2.Connect(IPAddress, name2);

                    Thread.Sleep(1000);

                    //trigger event
                    target2.terminate();

                    Assert.AreEqual(true, MRE.WaitOne(timeout), "Timed out waiting 1");
                    Assert.AreEqual(true, MRE1.WaitOne(timeout), "Timed out waiting 2");
                }
                finally
                { server.close(); }
            }