@@ -30,23 +30,20 @@ class DataService {
3030/// Mock service for testing - overrides command with MockCommand
3131class MockDataService implements DataService {
3232 @override
33- late final loadCommand = _mockCommand;
34-
35- final _mockCommand = MockCommand <String , List <Item >>(
33+ late final loadCommand = MockCommand <String , List <Item >>(
3634 initialValue: [],
3735 );
3836
3937 // Control methods make tests readable and maintainable
40- void simulateLoading () {
41- _mockCommand.startExecution ();
42- }
43-
44- void simulateSuccess (List <Item > data) {
45- _mockCommand.endExecutionWithData (data);
38+ void queueSuccess (String query, List <Item > data) {
39+ (loadCommand as MockCommand <String , List <Item >>)
40+ .queueResultsForNextExecuteCall ([
41+ CommandResult <String , List <Item >>(query, data, null , false ),
42+ ]);
4643 }
4744
4845 void simulateError (String message) {
49- _mockCommand .endExecutionWithError (message);
46+ (loadCommand as MockCommand ) .endExecutionWithError (message);
5047 }
5148}
5249
@@ -85,9 +82,7 @@ void main() {
8582 final testData = [Item ('1' , 'Test Item' )];
8683
8784 // Queue result for the next execution
88- mockService._mockCommand.queueResultsForNextExecuteCall ([
89- CommandResult <String , List <Item >>('test' , testData, null , false ),
90- ]);
85+ mockService.queueSuccess ('test' , testData);
9186
9287 // Execute the command through the manager
9388 await manager.loadData ('test' );
0 commit comments