static void Main(string[] args) { RLog.attach(RLog.makeConsoleStream()); RLog.start(); DLog.attach(DLog.makeConsoleStream()); DLog.start(); RLog.write("\n Demonstrating TestHarness - Project #4"); RLog.write("\n ========================================"); TestExec te = new TestExec(); Message msg_ = te.comm.rcvr.GetMessage(); Message msg = te.buildTestMessage(); te.testHarness.processMessages(msg_); te.comm.sndr.PostMessage(msg_); ServiceHost Shost = CreateChannel("http://localhost:8080/FileService1"); Shost.Open(); Console.Write("\n Press key to terminate service:\n"); Shost.Close(); Console.Write("\n Requirement #9 "); te.client.makeQuery("test1"); DLog.flush(); RLog.flush(); Console.Write("\n press key to exit"); Console.ReadKey(); DLog.stop(); RLog.stop(); }
static void Main(string[] args) { try { Console.Write("\n Demonstrating TestHarness - Project #2 with Threading"); Console.Write("\n ======================================================="); TestExec te = new TestExec(); Message msg = te.buildTestMessage(); Console.Write("\nCreated message: \n {0}", msg.ToString()); te.sendTestRequest(msg); te.sendTestRequest(msg); msg = msg.copy(); msg.body = "quit"; te.sendTestRequest(msg); te.testHarness.processMessages(); te.testHarness.wait(); te.client.makeQuery("test1"); Console.Write("\n\n"); } catch (Exception ex) { Console.Write("\n\n {0}\n\n", ex.Message); } }
void ThreadProc() //wait for the test Request and Process the request. { Console.Write("\n Demonstrating TestHarness - Project #4 with Threading"); Console.Write("\n ======================================================="); while (true) { // get message out of receive queue - will block if queue is empty rcvdMsg = recvr.GetMessage(); TestExec te = new TestExec(); te.sendTestRequest(rcvdMsg); // te.sendTestRequest(msg); te.testHarnessA.processMessages(); //te.client.makeQuery("test1"); //te.testHarnessA.wait(); } }
//[STAThread] static void Main(string[] args) { //MainWindow mainwindow = new MainWindow(); //ThreadStart doTests = () => mainwindow.Show(); DateTime before = System.DateTime.Now; try { //Console.Write("\n Demonstrating TestHarness - Project #2 with Threading"); Console.Write("\n ======================Remote TestHarness======================"); //Client client = Client.CreateClient(); //THServer thserver = THServer.CreateTHServer(); ///////////////////////////////////////////////////////////////////////////////////////////// Console.WriteLine("\n----------------------------Req 13------------------------------"); Console.WriteLine(" creating Test Executive"); TestExec te = new TestExec(); DateTime beforeSend = System.DateTime.Now; Message msg1 = te.client.makeMessage("Yuchang Chen", te.client.endPoint, te.client.remoteEndPoint_TH); msg1.body = MessageTest.makeTestRequest(); Client.SendfromCltoTH(msg1); DateTime afterSend = System.DateTime.Now; TimeSpan time = afterSend.Subtract(beforeSend); Console.WriteLine("\n----------------------------Req 12-----------------------------"); Console.WriteLine(" The time of sending message is {0} ms.", time.TotalMilliseconds); //te.testHarness.sendTestRequest(msg1); //msg1 = msg1.copy(); //msg1.body = "quit"; //Client.SendfromCltoTH(te.client, msg1); //te.testHarness.sendTestRequest(msg1); te.testHarness.processMessages(te.testHarness); //te.repository.saveResultsAndLogs(tr); te.client.makeQuery("test1"); //te.testHarness.wait(); ///////////////////////////////////////////////////////////////////////////////////////////////// //TestExec te = new TestExec(); //Message msg = te.buildTestMessage("Yuchang Chen", te.client.endPoint, te.client.endPoint); //te.sendTestRequest(msg); //te.sendTestRequest(msg); //msg = msg.copy(); //msg.body = "quit"; //te.sendTestRequest(msg); //te.testHarness.processMessages(); ////te.testHarness.wait(); ////te.client.makeQuery("test1"); ////Console.Write("\n\n"); Console.ReadKey(); } catch (Exception ex) { Console.Write("\n\n {0}\n\n", ex.Message); } DateTime after = System.DateTime.Now; TimeSpan ts = after.Subtract(before); Console.WriteLine("\n----------------------------Req 12-----------------------------"); Console.WriteLine(" The total execution time is {0} ms.", ts.TotalMilliseconds); }