You need to sign in to do that
Don't have an account?

Test class help needed!
I am trying to write a test class on the following trigger. I created an account and updated it by changin the prospect stage value and the trigger is called. But the deletion is not happening as I did not take care of the attachments. Can anyone please guide me..thanks in advance!!
trigger tgr_Account_After on Account (after insert, after update ){//before delete) {
//Disable Switch for this trigger managed by Custom Setting
if(TriggerSwitchSetting__c.getInstance('tgr_Account_After') != null
&& TriggerSwitchSetting__c.getInstance('tgr_Account_After').Disable__c ==true){
return; }
// declare the variables
set<id> setAccntid = new set<id>();
set<id> setAAid = new set<id>();
list<echosign_dev1__SIGN_Agreement__c> listAgreement = new list<echosign_dev1__SIGN_Agreement__c>();
// prepare the set of Account for the matching criteria
// call this code when Account is updated and the prospect stage changes and the value is "Cancelled Appointment"
for(Account acc : trigger.new){
if(trigger.isupdate && acc.Prospect_Stage_c__c != trigger.oldMap.get(acc.Id).Prospect_Stage_c__c && acc.Prospect_Stage_c__c == String_Constant__c.getInstance('Cancel_Appointment').String_Value__c){
setAccntid.add(acc.id);
}
}
// get the Drafted Agreement records for the Cancelled accounts
if(!setAccntid.isEmpty()){
for(New_Appoinment_pacakge__c AA:[select id, Account__c from New_Appoinment_pacakge__c where Account__c in: setAccntid]){
setAAid.add(AA.id);
}
// get the Agreement records which are to be deleted
for(echosign_dev1__SIGN_Agreement__c agreement:[select id, Agency_Agreement__c from echosign_dev1__SIGN_Agreement__c where Agency_Agreement__c in: setAAid]){
listAgreement.add(agreement);
}
// check if the retrieved list is not empty
if(!listAgreement.isEmpty())
delete listAgreement;
}
}