当前位置: 首页>>代码示例>>C#>>正文


C# C1Test类代码示例

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


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

示例1: 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

示例2: TestJoin1

		public void TestJoin1()
		{
			C1Test test1 = new C1Test();
			C1Test test2 = new C1Test();
			Thread thread1 = new Thread(new ThreadStart(test1.TestMethod));
			Thread thread2 = new Thread(new ThreadStart(test1.TestMethod2));
			try
			{
				thread1.Start();
				thread2.Start();
				thread2.Join();
			}
			catch(Exception e)
			{
				Fail("#91 Unexpected Exception " + e.ToString());
			}
			finally
			{
				thread1.Abort();
				thread2.Abort();
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:22,代码来源:ThreadTest.cs

示例3: C4Test

			public C4Test()
			{
				T1ON = false;
				T2ON = false;
				class1 = new C1Test();
				class2 = new C1Test();
				thread1 = new Thread(new ThreadStart(class1.TestMethod));
				thread2 = new Thread(new ThreadStart(class2.TestMethod));
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:ThreadTest.cs

示例4: TestCtor1

		public void TestCtor1()
		{			
			C1Test test1 = new C1Test();
			try
			{
				Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
			}
			catch (Exception e)
			{
				Fail ("#01 Unexpected Exception Thrown: " + e.ToString ());
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:ThreadTest.cs

示例5: TestJoin1

		public void TestJoin1()
		{
			C1Test test1 = new C1Test();
			C1Test test2 = new C1Test();
			Thread thread1 = new Thread(new ThreadStart(test1.TestMethod));
			Thread thread2 = new Thread(new ThreadStart(test1.TestMethod2));
			try {
				thread1.Start();
				thread2.Start();
				thread2.Join();
			} finally {
#if MONO_FEATURE_THREAD_ABORT
				thread1.Abort();
				thread2.Abort();
#else
				thread1.Interrupt ();
				thread2.Interrupt ();
#endif
			}
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:20,代码来源:ThreadTest.cs

示例6: C3Test

			public C3Test()
			{
				sub_class = new C1Test();
				sub_thread = new Thread(new ThreadStart(sub_class.TestMethod));
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:ThreadTest.cs

示例7: 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

示例8: ManagedThreadId

		[Test] // bug #82700
		public void ManagedThreadId ()
		{
			C1Test test1 = new C1Test ();
			Thread t1 = new Thread (new ThreadStart (test1.TestMethod));
			int mtA1 = t1.ManagedThreadId;
			t1.Start ();
			int mtA2 = t1.ManagedThreadId;
			t1.Join ();
			int mtA3 = t1.ManagedThreadId;
			Assert.AreEqual (mtA1, mtA2, "#A1");
			Assert.AreEqual (mtA2, mtA3, "#A2");

			test1 = new C1Test ();
			Thread t2 = new Thread (new ThreadStart (test1.TestMethod));
			int mtB1 = t2.ManagedThreadId;
			t2.Start ();
			int mtB2 = t2.ManagedThreadId;
			t2.Join ();
			int mtB3 = t2.ManagedThreadId;
			Assert.AreEqual (mtB1, mtB2, "#B1");
			Assert.AreEqual (mtB2, mtB3, "#B2");
			Assert.IsFalse (mtB1 == mtA1, "#B3");
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:24,代码来源:ThreadTest.cs

示例9: GetHashCodeTest

		[Test] // bug #325566
		public void GetHashCodeTest ()
		{
			C1Test test1 = new C1Test ();
			Thread tA = new Thread (new ThreadStart (test1.TestMethod));
			int hA1 = tA.GetHashCode ();
			Assert.IsTrue (hA1 > 0, "#A1");
			tA.Start ();
			int hA2 = tA.GetHashCode ();
			Assert.AreEqual (hA1, hA2, "#A2");
			tA.Join ();
			int hA3 = tA.GetHashCode ();
			Assert.AreEqual (hA1, hA3, "#A3");
			Assert.AreEqual (hA1, tA.ManagedThreadId, "#A4");

			test1 = new C1Test ();
			Thread tB = new Thread (new ThreadStart (test1.TestMethod));
			int hB1 = tB.GetHashCode ();
			Assert.IsTrue (hB1 > 0, "#B1");
			tB.Start ();
			int hB2 = tB.GetHashCode ();
			Assert.AreEqual (hB1, hB2, "#B2");
			tB.Join ();
			int hB3 = tB.GetHashCode ();
			Assert.AreEqual (hB1, hB3, "#B3");
			Assert.AreEqual (hB1, tB.ManagedThreadId, "#B4");
			Assert.IsFalse (hA2 == hB2, "#B5");
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:28,代码来源:ThreadTest.cs

示例10: TestCtor1

		public void TestCtor1()
		{
			C1Test test1 = new C1Test();
			Thread t = new Thread (new ThreadStart (test1.TestMethod));

			Assert.IsTrue (t.CurrentCulture.IsReadOnly, "CurrentCulture.IsReadOnly");
			Assert.IsFalse (t.IsAlive, "IsAlive");
			Assert.IsFalse (t.IsBackground, "IsBackground");
			Assert.IsNull (t.Name, "Name");
			Assert.AreEqual (ThreadState.Unstarted, t.ThreadState, "ThreadState");
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:11,代码来源:ThreadTest.cs

示例11: TestJoin1

		public void TestJoin1()
		{
			C1Test test1 = new C1Test();
			C1Test test2 = new C1Test();
			Thread thread1 = new Thread(new ThreadStart(test1.TestMethod));
			Thread thread2 = new Thread(new ThreadStart(test1.TestMethod2));
			try {
				thread1.Start();
				thread2.Start();
				thread2.Join();
			} finally {
				thread1.Abort();
				thread2.Abort();
			}
		}
开发者ID:nestalk,项目名称:mono,代码行数:15,代码来源:ThreadTest.cs


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