Salesforce: tests for email invocations

Salesforce: tests for email invocations
@isTest
private class TestClass {

static testMethod void testSendEmailsMethod(){

Test.startTest();
Integer emailsCountSentBefore = Limits.getEmailInvocations();
SomeClass.someMethodsWhichSendsEmails();
System.assertNotEquals(1, Limits.getEmailInvocations() – emailsCountSentBefore, ‘Should be increased by 1 or other value how many emails have been sent’);
Test.stopTest();

}
}

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s