Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core.AdapdevTests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17136/src/Adapdev.UnitTest.Core.AdapdevTests
Modified Files:
Adapdev.UnitTest.Core.AdapdevTests.csproj AdapdevAttributes.cs
Added Files:
MultiThreadedTest.cs
Log Message:
Added multi-threading support to testing engine
--- NEW FILE: MultiThreadedTest.cs ---
using System;
using System.Threading;
using Adapdev.UnitTest;
namespace Adapdev.UnitTest.Core.AdapdevTests
{
/// <summary>
/// Summary description for MultiThreadedTest.
/// </summary>
///
[TestFixture(IsMultiThreaded=true)]
public class MultiThreadedTest
{
int i = 0;
[Test]
public void Thread1()
{
i = 0;
int a = 0;
while(a <= 10)
{
i += 4;
Console.WriteLine("Thread1: " + i.ToString());
Thread.Sleep(5);
a++;
}
Console.WriteLine("Thread1: " + i.ToString());
Assert.IsFalse(i==44, "i equals 44, which means it was not interrupted by Thread2.");
}
[Test]
public void Thread2()
{
i = 0;
int a = 0;
while(a <= 10)
{
i += 10;
Console.WriteLine("Thread2: " + i.ToString());
Thread.Sleep(5);
a++;
}
Console.WriteLine("Thread2: " + i.ToString());
Assert.IsFalse(i==110, "i equals 110, which means it was not interrupted by Thread1.");
}
}
}
Index: Adapdev.UnitTest.Core.AdapdevTests.csproj
===================================================================
RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core.AdapdevTests/Adapdev.UnitTest.Core.AdapdevTests.csproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Adapdev.UnitTest.Core.AdapdevTests.csproj 23 Oct 2005 07:27:21 -0000 1.1
--- Adapdev.UnitTest.Core.AdapdevTests.csproj 26 Oct 2005 05:27:45 -0000 1.2
***************
*** 77,81 ****
<Reference
Name = "System.XML"
! AssemblyName = "System.XML"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
--- 77,81 ----
<Reference
Name = "System.XML"
! AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
***************
*** 99,102 ****
--- 99,107 ----
BuildAction = "Compile"
/>
+ <File
+ RelPath = "MultiThreadedTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
</Include>
</Files>
Index: AdapdevAttributes.cs
===================================================================
RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core.AdapdevTests/AdapdevAttributes.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AdapdevAttributes.cs 23 Oct 2005 07:27:21 -0000 1.1
--- AdapdevAttributes.cs 26 Oct 2005 05:27:45 -0000 1.2
***************
*** 1,3 ****
--- 1,4 ----
using System;
+ using System.Threading;
using Adapdev.UnitTest;
***************
*** 64,67 ****
--- 65,69 ----
{
Console.WriteLine("Test with description");
+ Console.WriteLine("Thread: " + AppDomain.GetCurrentThreadId());
}
***************
*** 156,159 ****
--- 158,162 ----
{
Console.WriteLine("Repeat");
+ Console.WriteLine("Thread: " + AppDomain.GetCurrentThreadId());
}
***************
*** 166,169 ****
--- 169,182 ----
{
Console.WriteLine("Repeat with delay");
+ Console.WriteLine("Thread: " + AppDomain.GetCurrentThreadId());
+ }
+
+ // A Test that is repeated a set number of times on multiple threads
+ [Test(Description="A Test that is repeated 5X, with a 3 second delay between each run.")]
+ [Repeat(5)]
+ public void MultiThreadedRepeat()
+ {
+ Console.WriteLine("Repeat with delay");
+ Console.WriteLine("Thread: " + AppDomain.GetCurrentThreadId());
}
|