Skip to main content
3 of 3
Added the SOQL query I'm trying to mock for this particular case

Is there a way I can mock an AggregateResult?

I'm trying to write most of my tests without hitting salesforce database. For that I'm implementing some simple mock class where I just return some SOQL queries when needed. The problem I'm facing now is with AggregateResult. Was someone able to create in memory this so that I can returned it in one of my mocked methods?

The query I want to mock in this particular case is: [SELECT MIN(CreatedDate) minCaseCreateDate FROM Case WHERE Id in :caseIds]