public void THMsgProc()
 {
     while (true)
     {
         HiResTimer hrt = new HiResTimer();
         Message    msg = msgReciever.TryGetTHMessage();
         Console.WriteLine("\n<--------------------------------------------------------->");
         Console.WriteLine("\nMessage recieved from test harness.");
         if (msg.recipient == "AboutLog")
         {
             Console.WriteLine("\nDemonstrating test logs and results:");
             TestResults tr = msgReciever.ParseResultMsg(msg);
             Console.WriteLine(tr.log);
             Console.WriteLine("\nDemonstrating querying results from repository:");
             Console.WriteLine("\nSending message to repository...");
             clientUtil.SetupQueryMessageToRepo(msgToRepoQuery, tr, "http://localhost:4244/ICommService/BasicHttp",
                                                "http://localhost:8284/ICommService/BasicHttp", "Upload");
             msgSenderwithRepo.channel.PostMessage(msgToRepoQuery);
             Console.WriteLine("\nWaiting for message from repository...");
             hrt.Start();
             Message repoReply = msgReciever.TryGetRepoMessage("Query");
             hrt.Stop();
             Console.WriteLine("");
             Console.WriteLine("\nRecieved message in {0} microsec.", hrt.ElapsedMicroseconds);
             Console.WriteLine("");
             TestLoadStatus loadStatus = msgReciever.ParseLoadMsg(repoReply);
             Console.WriteLine(loadStatus.loadMessage);
             using (FileStream fs = new FileStream(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\..\\..\\TestResults", tr.LogName + "Summary.txt"), FileMode.Open))
                 using (StreamReader sr = new StreamReader(fs))
                 {
                     Dispatcher.Invoke(
                         new Action <string>(ShowStringResult),
                         System.Windows.Threading.DispatcherPriority.Background,
                         new string[] { sr.ReadToEnd() });
                 }
         }
         else
         {
             Console.WriteLine("\nDemonstrating dll load status in test harness:");
             Dispatcher.Invoke(
                 new Action <string>(ShowLoadMsg),
                 System.Windows.Threading.DispatcherPriority.Background,
                 new string[] { msgReciever.ParseLoadMsg(msg).loadMessage });
         }
     }
 }
Пример #2
0
        public void THMsgProc()
        {
            while (true)
            {
                HiResTimer hrt = new HiResTimer();
                Message    msg = msgReciever.TryGetTHMessage();
                Console.WriteLine("\n<--------------------------------------------------------->");
                Console.WriteLine("\nMessage recieved from test harness.");
                if (msg.recipient == "AboutLog")
                {
                    Console.WriteLine("\nDemonstrating test logs and results:");
                    TestResults tr = msgReciever.ParseResultMsg(msg);
                    Console.WriteLine(tr.log);

                    Console.WriteLine("\nDemonstrating querying results from repository:");
                    Console.WriteLine("\nSending message to repository...");
                    SetupQueryMessageToRepo(tr, "http://localhost:4048/ICommService/BasicHttp",
                                            "http://localhost:8088/ICommService/BasicHttp", "Upload");

                    msgSenderwithRepo.channel.PostMessage(msgToRepoQuery);

                    Console.WriteLine("\nWaiting for message from repository...");
                    hrt.Start();
                    Message repoReply = msgReciever.TryGetRepoMessage("Query");
                    hrt.Stop();
                    Console.WriteLine("");
                    Console.WriteLine("\nRecieved message in {0} microsec.", hrt.ElapsedMicroseconds);
                    Console.WriteLine("");
                    TestLoadStatus loadStatus = msgReciever.ParseLoadMsg(repoReply);
                    Console.WriteLine(loadStatus.loadMessage);
                    if (loadStatus.status)
                    {
                        using (FileStream fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\..\\..\\TestResults", tr.LogName + "Summary.txt"), FileMode.Open))
                            using (StreamReader sr = new StreamReader(fs))
                            {
                                Console.WriteLine(sr.ReadToEnd());
                            }
                    }
                }
                else
                {
                    Console.WriteLine("\nDemonstrating dll load status in test harness:");
                    Console.WriteLine(msgReciever.ParseLoadMsg(msg).loadMessage);
                }
            }
        }