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]
Best Answer
Check edit history for my initial approach. After revisiting this question and with a bit more experience, I would pursue this path:
I was able to reference this query quite similar to how it would normally look:
And it would be quite easy to mock: