• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# C2Test类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中C2Test的典型用法代码示例。如果您正苦于以下问题:C# C2Test类的具体用法?C# C2Test怎么用?C# C2Test使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



C2Test类属于命名空间,在下文中一共展示了C2Test类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestThreadState

		public void TestThreadState ()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");

			//TODO: Test The rest of the possible transitions
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			Assert.AreEqual (ThreadState.Unstarted, TestThread.ThreadState, "#101 Wrong Thread State");
			try {
				TestThread.Start();
				//while(!TestThread.IsAlive); //In the MS Documentation this is not necessary
											  //but in the MS SDK it is
				Assert.IsTrue (TestThread.ThreadState == ThreadState.Running || (TestThread.ThreadState & ThreadState.Unstarted) != 0,
					"#102 Wrong Thread State: " + TestThread.ThreadState.ToString ());
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
			
			TestUtil.WaitForNotAlive (TestThread, "wait12");
			// Docs say state will be Stopped, but Aborted happens sometimes (?)
			Assert.IsTrue ((ThreadState.Stopped & TestThread.ThreadState) != 0 || (ThreadState.Aborted & TestThread.ThreadState) != 0,
				"#103 Wrong Thread State: " + TestThread.ThreadState.ToString ());
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:28,代码来源:ThreadTest.cs


示例2: TestApartmentState

		public void TestApartmentState ()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			Assert.AreEqual (ApartmentState.Unknown, TestThread.ApartmentState, "#1");
			TestThread.Start();
			TestUtil.WaitForAlive (TestThread, "wait5");
			Assert.AreEqual (ApartmentState.MTA, TestThread.ApartmentState, "#2");
#if MONO_FEATURE_THREAD_ABORT
			TestThread.Abort();
#else
			TestThread.Interrupt ();
#endif
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:14,代码来源:ThreadTest.cs


示例3: TestName

		public void TestName()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");

			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait10");
				string name = TestThread.Name;
				Assert.IsNull (name, "#61 Name set when mustn't be set: ");
				string newname = "Testing....";
				TestThread.Name = newname;
				Assert.AreEqual (newname, TestThread.Name, "#62 Name not set when must be set: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:23,代码来源:ThreadTest.cs


示例4: TestIsBackground1

		public void TestIsBackground1()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait9");
				bool state = TestThread.IsBackground;
				Assert("#51 IsBackground not set at the default state: ",!(state));
			}
			finally {
				TestThread.Abort();
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:14,代码来源:ThreadTest.cs


示例5: TestName

		public void TestName()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait10");
				string name = TestThread.Name;
				AssertEquals("#61 Name set when mustn't be set: ", name, (string)null);
				string newname = "Testing....";
				TestThread.Name = newname;
				AssertEquals("#62 Name not set when must be set: ",TestThread.Name,newname);
			}
			finally {
				TestThread.Abort();
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:17,代码来源:ThreadTest.cs


示例6: TestPriority1

		public void TestPriority1()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Priority=ThreadPriority.BelowNormal;
				ThreadPriority after = TestThread.Priority;
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait7");
				ThreadPriority before = TestThread.Priority;
				AssertEquals("#41 Unexpected Priority Change: ",before,after);
			}
			finally {
				TestThread.Abort();
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:ThreadTest.cs


示例7: TestPriority2

		[Category("NotWorking")] // this is a MonoTODO -> no support for Priority
		public void TestPriority2()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				AssertEquals("#42 Incorrect Priority in New thread: ",ThreadPriority.Normal, TestThread.Priority);
				TestThread.Start();
				TestUtil.WaitForAliveOrStop (TestThread, "wait8");
				AssertEquals("#43 Incorrect Priority in Started thread: ",ThreadPriority.Normal, TestThread.Priority);
			}
			finally {
				TestThread.Abort();
			}
			AssertEquals("#44 Incorrect Priority in Aborted thread: ",ThreadPriority.Normal, TestThread.Priority);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:ThreadTest.cs


示例8: TestStart

		[Category ("NotDotNet")] // it hangs.
		public void TestStart()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on Win32. The test should be fixed.");
		{
			C1Test test1 = new C1Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.Start();
			TestThread.Join();
			Assert.AreEqual (10, test1.cnt, "#1");
		}
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.Start();
#if MONO_FEATURE_THREAD_ABORT
			TestThread.Abort();
#else
			TestThread.Interrupt ();
#endif
			try {
				TestThread.Start();
				Assert.Fail ("#2");
			} catch (ThreadStateException) {
			}
		}
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.Start();
			while (!test1.run) {
			}
			bool started = (TestThread.ThreadState == ThreadState.Running);
			Assert.AreEqual (started, test1.run, "#15 Thread Is not in the correct state: ");
#if MONO_FEATURE_THREAD_ABORT
			TestThread.Abort();
#else
			TestThread.Interrupt ();
#endif
		}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:42,代码来源:ThreadTest.cs


示例9: TestApartmentState

		public void TestApartmentState ()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on mono on win32. Our runtime should be fixed.");

			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			Assert.AreEqual (ApartmentState.Unknown, TestThread.ApartmentState, "#1");
			TestThread.Start();
			TestUtil.WaitForAlive (TestThread, "wait5");
			Assert.AreEqual (ApartmentState.MTA, TestThread.ApartmentState, "#2");
#if MONO_FEATURE_THREAD_ABORT
			TestThread.Abort();
#else
			TestThread.Interrupt ();
#endif
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:17,代码来源:ThreadTest.cs


示例10: TestIsBackground2

		public void TestIsBackground2 ()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.IsBackground = true;
			try {
				TestThread.Start();
			} finally {
				TestThread.Abort();
			}
			
			if (TestThread.IsAlive) {
				try {
					Assert.IsTrue (TestThread.IsBackground, "#52 Is Background Changed to Start ");
				} catch (ThreadStateException) {
					// Ignore if thread died meantime
				}
			}
		}
开发者ID:sesef,项目名称:mono,代码行数:19,代码来源:ThreadTest.cs


示例11: TestPriority1

		public void TestPriority1()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");

			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Priority=ThreadPriority.BelowNormal;
				ThreadPriority after = TestThread.Priority;
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait7");
				ThreadPriority before = TestThread.Priority;
				Assert.AreEqual (before, after, "#41 Unexpected Priority Change: ");
			} finally {
				TestThread.Abort();
			}
		}
开发者ID:nestalk,项目名称:mono,代码行数:18,代码来源:ThreadTest.cs


示例12: TestName

		public void TestName()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait10");
				string name = TestThread.Name;
				Assert.IsNull (name, "#61 Name set when mustn't be set: ");
				string newname = "Testing....";
				TestThread.Name = newname;
				Assert.AreEqual (newname, TestThread.Name, "#62 Name not set when must be set: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:20,代码来源:ThreadTest.cs


示例13: TestIsBackground1

		public void TestIsBackground1 ()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait9");
				bool state = TestThread.IsBackground;
				Assert.IsFalse (state, "#51 IsBackground not set at the default state: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:17,代码来源:ThreadTest.cs


示例14: TestPriority1

		[Category ("NotWorking")] // setting the priority of a Thread before it is started isn't implemented in Mono yet
		public void TestPriority1()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Priority=ThreadPriority.BelowNormal;
				ThreadPriority before = TestThread.Priority;
				Assert.AreEqual (ThreadPriority.BelowNormal, before, "#40 Unexpected priority before thread start: ");
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait7");
				ThreadPriority after = TestThread.Priority;
				Assert.AreEqual (before, after, "#41 Unexpected Priority Change: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:21,代码来源:ThreadTest.cs


示例15: TestStart

		public void TestStart()
		{
		{
			C1Test test1 = new C1Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try
			{
				TestThread.Start();
			}
			catch (Exception e)
			{
				Fail ("#12 Unexpected Exception Thrown: " + e.ToString ());
			}
			TestThread.Join();
			AssertEquals("#13 Thread Not started: ", 10,test1.cnt);
		}
		{
			bool errorThrown = false;
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.Start();
			TestThread.Abort();
			try
			{
				TestThread.Start();
			}
			catch(ThreadStateException)
			{
				errorThrown = true;
			}
			Assert ("#14 no ThreadStateException trown", errorThrown);
		}
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			TestThread.Start();
			while(!test1.run);
			bool started = (TestThread.ThreadState == ThreadState.Running);
			AssertEquals("#15 Thread Is not in the correct state: ", started , test1.run);	
			TestThread.Abort();
		}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:42,代码来源:ThreadTest.cs


示例16: TestPriority1

		[Category ("NotWorking")] // setting the priority of a Thread before it is started isn't implemented in Mono yet
		public void TestPriority1()
		{
			if (is_win32 && is_mono)
				Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");

			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Priority=ThreadPriority.BelowNormal;
				ThreadPriority before = TestThread.Priority;
				Assert.AreEqual (ThreadPriority.BelowNormal, before, "#40 Unexpected priority before thread start: ");
				TestThread.Start();
				TestUtil.WaitForAlive (TestThread, "wait7");
				ThreadPriority after = TestThread.Priority;
				Assert.AreEqual (before, after, "#41 Unexpected Priority Change: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:24,代码来源:ThreadTest.cs


示例17: TestApartmentState

		public void TestApartmentState()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			ApartmentState before = TestThread.ApartmentState;
			TestThread.Start();
			TestUtil.WaitForAlive (TestThread, "wait6");
			ApartmentState after = TestThread.ApartmentState;
			TestThread.Abort();
			AssertEquals("#31 Apartment State Changed when not needed: ",before,after);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:ThreadTest.cs


示例18: TestPriority2

		[Category ("NotWorking")] // this is a MonoTODO -> no support for Priority
		public void TestPriority2()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				Assert.AreEqual (ThreadPriority.Normal, TestThread.Priority, "#42 Incorrect Priority in New thread: ");
				TestThread.Start();
				TestUtil.WaitForAliveOrStop (TestThread, "wait8");
				Assert.AreEqual (ThreadPriority.Normal, TestThread.Priority, "#43 Incorrect Priority in Started thread: ");
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
			Assert.AreEqual (ThreadPriority.Normal, TestThread.Priority, "#44 Incorrect Priority in Aborted thread: ");
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:19,代码来源:ThreadTest.cs


示例19: AbortUnstarted

		public void AbortUnstarted ()
		{
			C2Test test1 = new C2Test();
			Thread th = new Thread (new ThreadStart (test1.TestMethod));
			th.Abort ();
			th.Start ();
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:ThreadTest.cs


示例20: TestPriority3

		[Category ("NotWorking")] // this is a MonoTODO -> no support for Priority
		public void TestPriority3()
		{
			C2Test test1 = new C2Test();
			Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			try {
				TestThread.Start();
				TestThread.Priority = ThreadPriority.Lowest;
				Assert.AreEqual (ThreadPriority.Lowest, TestThread.Priority, "#45A Incorrect Priority:");
				TestThread.Priority = ThreadPriority.BelowNormal;
				Assert.AreEqual (ThreadPriority.BelowNormal, TestThread.Priority, "#45B Incorrect Priority:");
				TestThread.Priority = ThreadPriority.Normal;
				Assert.AreEqual (ThreadPriority.Normal, TestThread.Priority, "#45C Incorrect Priority:");
				TestThread.Priority = ThreadPriority.AboveNormal;
				Assert.AreEqual (ThreadPriority.AboveNormal, TestThread.Priority, "#45D Incorrect Priority:");
				TestThread.Priority = ThreadPriority.Highest;
				Assert.AreEqual (ThreadPriority.Highest, TestThread.Priority, "#45E Incorrect Priority:");
			}
			finally {
#if MONO_FEATURE_THREAD_ABORT
				TestThread.Abort();
#else
				TestThread.Interrupt ();
#endif
			}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:26,代码来源:ThreadTest.cs



注:本文中的C2Test类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CALayer类代码示例发布时间:2022-05-24
下一篇:
C# C1Test类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap