Support for mocking multiple times #136
santiagoparradev
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Hi @santiagoparradev , As far as I understand, you would like a "stack" from which the mocked result will be retrieved. e.g. Account accountA = new Account(Name = 'Test A');
SOQL.mock('AccountQuery', accountA);
Account accountB = new Account(Name = 'Test B');
SOQL.mock('AccountQuery', accountB);
Test.startTest();
Account account1 = SOQL.of(Account.SObjectType).mockId('AccountQuery').toObject();
Account account2 = SOQL.of(Account.SObjectType).mockId('AccountQuery').toObject();
Test.stopTest();
Assert.areEqual(accountA, account1);
Assert.areEqual(accountB, account2); If Is that correct? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
sometimes the same query can run múltiple times throughout a process
it would be great to be able to
SOQL.mockOnce(mockId, firstCall);
SOQL.mockOnce(mockId, secondCall);
Beta Was this translation helpful? Give feedback.
All reactions