Exemple #1
0
        [Test] public void CreateRunnableRunsActionWhenCalled()
        {
            var action = MockRepository.GenerateMock <Action>();
            var r      = Executors.CreateRunnable(action);

            r.Run();
            action.AssertWasCalled(a => a());
        }
Exemple #2
0
 /// <summary>
 /// Executes the given task at some time in the future.
 /// </summary>
 /// <remarks>
 /// The task may execute in a new thread, in a pooled thread, or in the calling
 /// thread, at the discretion of the <see cref="IExecutor"/> implementation.
 /// </remarks>
 /// <param name="task">The task to be executed.</param>
 /// <exception cref="Spring.Threading.Execution.RejectedExecutionException">
 /// If the task cannot be accepted for execution.
 /// </exception>
 /// <exception cref="System.ArgumentNullException">
 /// If the <paramref name="task"/> is <c>null</c>
 /// </exception>
 public virtual void Execute(Task task)
 {
     Execute(Executors.CreateRunnable(task));
 }
Exemple #3
0
        [Test] public void CreateRunnableChokesOnNullAction()
        {
            var e = Assert.Throws <ArgumentNullException>(() => Executors.CreateRunnable(null));

            Assert.That(e.ParamName, Is.EqualTo("action"));
        }