Created
February 25, 2020 13:55
-
-
Save Feldstrom/43dfc2b7bf2a7fbb90d876cd3c2a4a81 to your computer and use it in GitHub Desktop.
This file contains 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 CasePBTestClass{ | |
@isTest | |
static void record_is_pcf_collection(){ | |
Case firstCase = new Case(); | |
insert firstCase; | |
Contact relatedContact = new Contact(); | |
relatedContact.firstName = 'Bob'; | |
relatedContact.lastName = 'Bobsen'; | |
relatedContact.Latest_PCF_Collection__c = firstCase.Id; | |
insert relatedContact; | |
Case pbCase = new Case(); | |
pbCase.Subject = 'PCF Collection Case'; | |
pbCase.Status = 'Pending'; | |
pbCase.ContactID = relatedContact.Id; | |
pbCase.RecordTypeId = Case.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get('PCF_Collection').getRecordTypeId(); | |
insert pbCase; | |
relatedContact = [SELECT Latest_PCF_Collection__c FROM Contact WHERE Id=:relatedContact.Id]; | |
System.assertEquals(pbCase.Id, relatedContact.Latest_PCF_Collection__c); | |
} | |
@isTest | |
static void retention_case_closed(){ | |
Contact retentionContact = new Contact(); | |
retentionContact.firstName = 'Gwen'; | |
retentionContact.lastName = 'Stacy'; | |
retentionContact.email = 'gwenstacy@ccnoemail.com'; | |
retentionContact.RecordTypeId = Contact.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get('Customer').getRecordTypeId(); | |
insert retentionContact; | |
Case newRetentionCase = new Case(); | |
newRetentionCase.ContactId = retentionContact.Id; | |
newRetentionCase.Status = 'New'; | |
newRetentionCase.Subject = 'Retention Case'; | |
newRetentionCase.RecordTypeId = Case.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get('Retention_Case').getRecordTypeId(); | |
insert newRetentionCase; | |
newRetentionCase.ContactID = retentionContact.Id; | |
newRetentionCase.RecordTypeId = Case.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get('Retention_Case').getRecordTypeId(); | |
newRetentionCase.Status = 'Closed Lost'; | |
update newRetentionCase; | |
retentionContact = [SELECT Last_Retention_Closed_Date__c FROM Contact WHERE Id =:retentionContact.Id]; | |
System.assertEquals(Date.today(), retentionContact.Last_Retention_Closed_Date__c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment