本文整理汇总了C#中C2Test类的典型用法代码示例。如果您正苦于以下问题:C#C2Test类的具体用法?C#C2Test怎么用?C#C2Test使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:TestThreadState publicvoidTestThreadState() { if(is_win32&&is_mono) Assert.Fail("ThistestfailsonmonoonWin32.Ourruntimeshouldbefixed.");
//TODO:TestTherestofthepossibletransitions C2Testtest1=newC2Test(); ThreadTestThread=newThread(newThreadStart(test1.TestMethod)); Assert.AreEqual(ThreadState.Unstarted,TestThread.ThreadState,"#101WrongThreadState"); try{ TestThread.Start(); //while(!TestThread.IsAlive);//IntheMSDocumentationthisisnotnecessary //butintheMSSDKitis Assert.IsTrue(TestThread.ThreadState==ThreadState.Running||(TestThread.ThreadState&ThreadState.Unstarted)!=0, "#102WrongThreadState:"+TestThread.ThreadState.ToString()); }finally{
#ifMONO_FEATURE_THREAD_ABORT TestThread.Abort();
#else TestThread.Interrupt();
#endif } TestUtil.WaitForNotAlive(TestThread,"wait12"); //DocssaystatewillbeStopped,butAbortedhappenssometimes(?) Assert.IsTrue((ThreadState.Stopped&TestThread.ThreadState)!=0||(ThreadState.Aborted&TestThread.ThreadState)!=0, "#103WrongThreadState:"+TestThread.ThreadState.ToString()); }
原文链接:
http://www.jxszl.com/biancheng/C/556628.html