Skip to content

Instantly share code, notes, and snippets.

@brianmfear
Created August 20, 2024 19:34
Show Gist options
  • Save brianmfear/3648e7ae9557f18d8385b4262c035bb0 to your computer and use it in GitHub Desktop.
Save brianmfear/3648e7ae9557f18d8385b4262c035bb0 to your computer and use it in GitHub Desktop.
q425223 support
@isTest class sendAnEmailSeleTest {
@isTest static void test() {
// Prepare your record data, possibly including parent/related records
Selement__c testSelement = new Selement__c(
// Populate fields here
Name = 'Test' // field = value, field = value, ...
);
insert testSelement;
// Build your request
sendAnEmailSele.Request[] requests = new sendAnEmailSele.Request[0];
sendAnEmailSele.Request request = new sendAnEmailSele.Request();
request.quoteId = testSelement.Id;
request.email = '[email protected]';
requests.add(request);
Test.startTest();
sendAnEmailSele.sendEmailWithAttachment(requests);
Test.stopTest();
// Always verify the expected output with assertions
Attachment[] result = [SELECT ParentId FROM Attachment WHERE ParentId = :testSelement.Id];
Assert.areEqual(1, result.size(), 'expected an attachment to be created');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment