Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Threading
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv5850/test/Spring/Spring.Core.Tests/Threading
Modified Files:
AsyncTestMethod.cs AsyncTestTask.cs
Log Message:
fixed SPRNET-824
additional tests
Index: AsyncTestMethod.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Threading/AsyncTestMethod.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AsyncTestMethod.cs 30 May 2007 17:32:29 -0000 1.1
--- AsyncTestMethod.cs 2 Feb 2008 10:24:38 -0000 1.2
***************
*** 23,26 ****
--- 23,27 ----
using System;
using System.Threading;
+ using NUnit.Framework;
#endregion
***************
*** 35,43 ****
public class AsyncTestMethod : AsyncTestTask
{
! private ThreadStart callback;
! public AsyncTestMethod(int iterations, ThreadStart callback)
! : base(iterations)
{
this.callback = callback;
}
--- 36,72 ----
public class AsyncTestMethod : AsyncTestTask
{
! public delegate object TestMethod(object[] args);
! private readonly TestMethod callback;
! private readonly object[] args;
! private object result;
!
! private class ThreadStartTestMethodAdapter
! {
! private readonly ThreadStart threadStart;
!
! public ThreadStartTestMethodAdapter(ThreadStart threadStart)
! {
! Assert.IsNotNull(threadStart);
! this.threadStart = threadStart;
! }
!
! public object Execute(object[] args)
! {
! threadStart();
! return null;
! }
! }
!
! public AsyncTestMethod(int iterations, ThreadStart callback, params object[] args)
! : this(iterations, new TestMethod(new ThreadStartTestMethodAdapter(callback).Execute), args)
{
+ }
+
+
+ public AsyncTestMethod(int iterations, TestMethod callback, params object[] args) : base(iterations)
+ {
+ Assert.IsNotNull(callback);
+ this.args = args;
this.callback = callback;
}
***************
*** 45,49 ****
public override void DoExecute()
{
! callback();
}
}
--- 74,83 ----
public override void DoExecute()
{
! result = callback(args);
! }
!
! public object Result
! {
! get { return result; }
}
}
Index: AsyncTestTask.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Threading/AsyncTestTask.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AsyncTestTask.cs 30 May 2007 18:37:11 -0000 1.1
--- AsyncTestTask.cs 2 Feb 2008 10:24:38 -0000 1.2
***************
*** 37,41 ****
private Exception exception;
private Thread t;
! private int iterations;
private int iterationno;
--- 37,41 ----
private Exception exception;
private Thread t;
! private readonly int iterations;
private int iterationno;
|