Inheritance Hierarchy
DeltaEngine.Tests.Extensions ThreadExtensionTests
Namespace: DeltaEngine.Tests.Extensions
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ThreadExtensionTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ThreadExtensionTests | Initializes a new instance of the ThreadExtensionTests class |
Methods
Name | Description | |
---|---|---|
EnqueueWorkerThreadNoArgs | ||
EnqueueWorkerThreadOneArg | ||
EnqueueWorkerThreadTwoArgs | ||
Start1 | ||
Start2 | ||
Start3 |
Examples
[Test] public void Start1() { int num = 1; Assert.AreEqual(1, num); Thread t = ThreadExtensions.Start(() => IncrementNumber(ref num)); t.Join(); Assert.AreEqual(2, num); }
[Test] public void Start2() { Thread t = ThreadExtensions.Start("thread name", () => { });
[Test] public void Start3() { const string Param = "name from parameter"; Thread t = ThreadExtensions.Start(UpdateNameViaParameter, Param); t.Join(); Assert.AreEqual(Param, t.Name); }
[Test] public void EnqueueWorkerThreadNoArgs() { Assert.IsTrue(ThreadExtensions.EnqueueWorkerThread(() => ValueSettingTestAction())); }
[Test] public void EnqueueWorkerThreadOneArg() { const int Num = 1; ThreadExtensions.EnqueueWorkerThread(Num, val => { ValueSettingTestAction(Num); });
[Test] public void EnqueueWorkerThreadTwoArgs() { const int Num1 = 1; const int Num2 = 2; ThreadExtensions.EnqueueWorkerThread(Num1, Num2, (val1, val2) => { ValueSettingTestAction(val1, val2); });
See Also