TDataSeries<T>
This commit is contained in:
@@ -213,11 +213,11 @@ begin
|
||||
// if not FOwnerFixture.FNotifier.IsFinalized then // Don't notify if finalized
|
||||
begin
|
||||
FOwnerFixture.FNotifier.Notify(
|
||||
function(Item: IMyStressTestInterface): Boolean
|
||||
begin
|
||||
Item.Foo(FThreadID); // Pass ThreadID as notification type for context
|
||||
Result := True; // Keep item
|
||||
end
|
||||
function(Item: IMyStressTestInterface): Boolean
|
||||
begin
|
||||
Item.Foo(FThreadID); // Pass ThreadID as notification type for context
|
||||
Result := True; // Keep item
|
||||
end
|
||||
);
|
||||
end;
|
||||
finally
|
||||
@@ -359,11 +359,11 @@ begin
|
||||
// if not FNotifier.IsFinalized then
|
||||
begin
|
||||
FNotifier.Notify(
|
||||
function(Item: IMyStressTestInterface): Boolean
|
||||
begin
|
||||
actualLiveReceiversInNotifier.Add(Item);
|
||||
Result := True;
|
||||
end
|
||||
function(Item: IMyStressTestInterface): Boolean
|
||||
begin
|
||||
actualLiveReceiversInNotifier.Add(Item);
|
||||
Result := True;
|
||||
end
|
||||
);
|
||||
end;
|
||||
finally
|
||||
@@ -373,12 +373,12 @@ begin
|
||||
|
||||
// 2. Compare overall counts
|
||||
Assert.AreEqual(
|
||||
totalExpectedLiveByThreadsAtEnd,
|
||||
actualLiveInNotifierAtEnd,
|
||||
Format(
|
||||
'Mismatch in live item count at end. Threads expected %d, Notifier has %d.',
|
||||
[totalExpectedLiveByThreadsAtEnd, actualLiveInNotifierAtEnd]
|
||||
)
|
||||
totalExpectedLiveByThreadsAtEnd,
|
||||
actualLiveInNotifierAtEnd,
|
||||
Format(
|
||||
'Mismatch in live item count at end. Threads expected %d, Notifier has %d.',
|
||||
[totalExpectedLiveByThreadsAtEnd, actualLiveInNotifierAtEnd]
|
||||
)
|
||||
);
|
||||
|
||||
// 3. Detailed check: Iterate all receivers ever created.
|
||||
@@ -400,27 +400,22 @@ begin
|
||||
end;
|
||||
|
||||
Assert.AreEqual(
|
||||
receiver.ExpectedToBeAdvised,
|
||||
found,
|
||||
Format(
|
||||
'Receiver ID %d: Thread expected it to be advised=%d, but its presence in Notifier is %d. NotificationCount=%d',
|
||||
[
|
||||
receiver.GetInstanceID,
|
||||
Integer(receiver.ExpectedToBeAdvised),
|
||||
Integer(found),
|
||||
receiver.GetNotificationCount
|
||||
]
|
||||
)
|
||||
receiver.ExpectedToBeAdvised,
|
||||
found,
|
||||
Format(
|
||||
'Receiver ID %d: Thread expected it to be advised=%d, but its presence in Notifier is %d. NotificationCount=%d',
|
||||
[receiver.GetInstanceID, Integer(receiver.ExpectedToBeAdvised), Integer(found), receiver.GetNotificationCount]
|
||||
)
|
||||
);
|
||||
|
||||
// Further checks on NotificationCount could be added if specific notification patterns were expected.
|
||||
// For this chaos test, ensuring count is non-negative and consistent with advised state is a good start.
|
||||
Assert.IsTrue(
|
||||
receiver.GetNotificationCount >= 0,
|
||||
Format(
|
||||
'Receiver ID %d has non-positive notification count: %d',
|
||||
[receiver.GetInstanceID, receiver.GetNotificationCount]
|
||||
)
|
||||
receiver.GetNotificationCount >= 0,
|
||||
Format(
|
||||
'Receiver ID %d has non-positive notification count: %d',
|
||||
[receiver.GetInstanceID, receiver.GetNotificationCount]
|
||||
)
|
||||
);
|
||||
if found and (receiver.GetNotificationCount = 0) then
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user