• Nishant Kumar 274
  • NEWBIE
  • 30 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Create custom field Discount Percent on Discount object and use in the below code:-
public class DiscountTriggerHelper {
    
    public static void beforeTrigApplyDiscount(List<Discount__c> discounts){
        
        for(Discount__c disc : discounts){
            If(disc.Discount_Applied__c == false && disc.Amount__c >= 100){
                disc.Amount__c = disc.Amount__c + 10;
                disc.Discount_Applied__c = true;
            }
        }
    }
}
Please help me in writing a test class for a trigger helper class for below code:-
public class DiscountTriggerHelper {
    
    public static void beforeTrigApplyDiscount(List<Discount__c> discounts){
        
        for(Discount__c disc : discounts){
            If(disc.Discount_Applied__c == false && disc.Amount__c >= 100){
                disc.Amount__c = disc.Amount__c + 10;
                disc.Discount_Applied__c = true;
            }
        }
    }
}
Please help me in writing a test class for a trigger:-

trigger applyDiscountTrg on Discount__c (before insert, before update) {
    
    System.debug(Trigger.New);
    System.debug(Trigger.NewMap);
    //Call Trigger helper class
    DiscountTriggerHelper.beforeTrigApplyDiscount(Trigger.New);
    
}
Write a program that reads a set of integers, and then prints the sum of the even and odd integers.
Please help me in writing a test class for a trigger helper class for below code:-
public class DiscountTriggerHelper {
    
    public static void beforeTrigApplyDiscount(List<Discount__c> discounts){
        
        for(Discount__c disc : discounts){
            If(disc.Discount_Applied__c == false && disc.Amount__c >= 100){
                disc.Amount__c = disc.Amount__c + 10;
                disc.Discount_Applied__c = true;
            }
        }
    }
}
Write a program that reads a set of integers, and then prints the sum of the even and odd integers.