예제 #1
0
        public void TestAnnounceDevice()
        {
            Console.WriteLine("Test to announce an upnp device.");
            UPnP u = new UPnP();
            u.SetupSockets();
            MediaBrowser mb = new MediaBrowser();

            bool wait = true;
            //     wait = false;
            u.AnnounceDevice(mb,true);
            Console.WriteLine("Waiting for data");
            DateTime start = DateTime.Now;
            while (wait)
            {
                if (DateTime.Now - start > new TimeSpan(0, 0, 60))
                {
                    Console.WriteLine("");
                    Console.WriteLine("Operation took too long");
                    wait = false;
                    Assert.Fail("Operation took too long");
                }
                Console.Write(".");
                Thread.Sleep(250);
            }
            Console.WriteLine("UPnP Device Announcing Test successful.");

            u.CloseSockets();
        }