TDataSeries<T>
This commit is contained in:
+46
-46
@@ -92,13 +92,13 @@ begin
|
||||
jobCompletedLatch := TLatch.Construct(1); // Changed from Signals.CreateLatch
|
||||
|
||||
FFactory
|
||||
.Run(
|
||||
procedure
|
||||
begin
|
||||
jobExecuted := True;
|
||||
jobCompletedLatch.Notify;
|
||||
end)
|
||||
.Notify;
|
||||
.Run(
|
||||
procedure
|
||||
begin
|
||||
jobExecuted := True;
|
||||
jobCompletedLatch.Notify;
|
||||
end)
|
||||
.Notify;
|
||||
|
||||
FFactory.WaitFor(jobCompletedLatch.State);
|
||||
Assert.IsTrue(jobExecuted, 'Immediate job should have executed');
|
||||
@@ -114,13 +114,13 @@ begin
|
||||
jobCompletedLatch := TLatch.Construct(1); // Changed from Signals.CreateLatch
|
||||
|
||||
subscriber :=
|
||||
FFactory.Run(
|
||||
procedure
|
||||
begin
|
||||
jobExecuted := True;
|
||||
jobCompletedLatch.Notify;
|
||||
end
|
||||
);
|
||||
FFactory.Run(
|
||||
procedure
|
||||
begin
|
||||
jobExecuted := True;
|
||||
jobCompletedLatch.Notify;
|
||||
end
|
||||
);
|
||||
|
||||
Assert.IsNotNull(subscriber, 'Run should return a subscriber for delayed job');
|
||||
// Use TMycLatch.Null for comparison
|
||||
@@ -162,12 +162,12 @@ begin
|
||||
Assert.IsFalse(FFactory.InWorkerThread, 'Test method itself should not be in a factory worker thread');
|
||||
|
||||
FFactory.EnqueueJob(
|
||||
procedure
|
||||
begin
|
||||
inMainThreadInJob := FFactory.InMainThread;
|
||||
inWorkerThreadInJob := FFactory.InWorkerThread;
|
||||
jobDoneLatch.Notify;
|
||||
end
|
||||
procedure
|
||||
begin
|
||||
inMainThreadInJob := FFactory.InMainThread;
|
||||
inWorkerThreadInJob := FFactory.InWorkerThread;
|
||||
jobDoneLatch.Notify;
|
||||
end
|
||||
);
|
||||
|
||||
FFactory.WaitFor(jobDoneLatch.State);
|
||||
@@ -183,20 +183,20 @@ begin
|
||||
jobDoneLatch := TLatch.Construct(1);
|
||||
|
||||
FFactory.EnqueueJob(
|
||||
procedure
|
||||
begin
|
||||
try
|
||||
raise TMycTaskFactory.ETaskException.Create('Test Exception From Job');
|
||||
finally
|
||||
jobDoneLatch.Notify;
|
||||
end;
|
||||
end
|
||||
procedure
|
||||
begin
|
||||
try
|
||||
raise TMycTaskFactory.ETaskException.Create('Test Exception From Job');
|
||||
finally
|
||||
jobDoneLatch.Notify;
|
||||
end;
|
||||
end
|
||||
);
|
||||
|
||||
Assert.WillRaise(
|
||||
procedure begin FFactory.WaitFor(jobDoneLatch.State); end,
|
||||
TMycTaskFactory.ETaskException,
|
||||
'WaitFor should re-raise the exception from the job'
|
||||
procedure begin FFactory.WaitFor(jobDoneLatch.State); end,
|
||||
TMycTaskFactory.ETaskException,
|
||||
'WaitFor should re-raise the exception from the job'
|
||||
);
|
||||
|
||||
var noExceptionRaised: Boolean := True;
|
||||
@@ -213,9 +213,9 @@ begin
|
||||
FFactory.Teardown;
|
||||
|
||||
Assert.WillRaise(
|
||||
procedure begin FFactory.EnqueueJob(procedure begin end); end,
|
||||
TMycTaskFactory.ETaskException,
|
||||
'Running a job on a torn-down factory should raise ETaskException'
|
||||
procedure begin FFactory.EnqueueJob(procedure begin end); end,
|
||||
TMycTaskFactory.ETaskException,
|
||||
'Running a job on a torn-down factory should raise ETaskException'
|
||||
);
|
||||
end;
|
||||
|
||||
@@ -230,18 +230,18 @@ begin
|
||||
dummyStateToWaitFor := TLatch.Construct(1).State;
|
||||
|
||||
FFactory.EnqueueJob(
|
||||
procedure
|
||||
begin
|
||||
try
|
||||
FFactory.WaitFor(dummyStateToWaitFor);
|
||||
except
|
||||
on E: TMycTaskFactory.ETaskException do
|
||||
begin
|
||||
exceptionCaughtInJob := True;
|
||||
end;
|
||||
end;
|
||||
jobDoneLatch.Notify;
|
||||
end
|
||||
procedure
|
||||
begin
|
||||
try
|
||||
FFactory.WaitFor(dummyStateToWaitFor);
|
||||
except
|
||||
on E: TMycTaskFactory.ETaskException do
|
||||
begin
|
||||
exceptionCaughtInJob := True;
|
||||
end;
|
||||
end;
|
||||
jobDoneLatch.Notify;
|
||||
end
|
||||
);
|
||||
|
||||
FFactory.WaitFor(jobDoneLatch.State);
|
||||
|
||||
Reference in New Issue
Block a user