Last active
March 18, 2016 12:05
-
-
Save mkorman/673f1369cca603f43694 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class TestCreateInitialCallTaskTrigger | |
{ | |
@isTest | |
public static void TestInitialCallTaskIsCreated () | |
{ | |
Lead l = new Lead (LastName = 'Test', Company = 'Acme'); | |
insert l; | |
List<Task> createdTasks = [SELECT Subject, WhoId, ActivityDate FROM Task]; | |
System.AssertEquals (1, createdTasks.size(), 'Expected 1 task to be created'); | |
Task initialCallTask = createdTasks [0]; | |
System.AssertEquals (Date.Today().AddDays(2), initialCallTask.ActivityDate, 'Expected the task to expire in 2 days'); | |
System.AssertEquals ('Intial call', initialCallTask.Subject, 'Unexpected subject on followup task'); | |
System.AssertEquals (l.id, initialCallTask.WhoId, 'Followup Task should be associated with the newly created lead'); | |
} | |
@isTest | |
public static void TestBulkCreationCreatesTasks () | |
{ | |
Integer leadCount = 151; | |
List<Lead> allLeads = new List<Lead>(); | |
for (Integer i = 0; i < leadCount; i++) | |
{ | |
allLeads.Add (new Lead(LastName = 'Test', Company = 'Acme')); | |
} | |
insert allLeads; | |
System.AssertEquals (leadCount, [SELECT Id FROM Task].size(), 'Expected one task to be created for each new lead'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment