function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priya 777Priya 777 

New to Developing Please help me with Test Class for this trigger

trigger DCStargeting on Account (before insert,before update,after insert,after update) {
    Set<id> userIds = new Set<Id>();
    for (Account o : Trigger.new){
        userIds.add(o.OwnerId);
        if(o.Floorplan_Source2__c!=null&&o.Floorplan_Source2__c!=o.Current_Floor_Plan__c){
            o.Current_Floor_Plan__c=o.Floorplan_Source2__c;
        o.DCS_targeting_date__c= Date.today();
                      
        }
    }
}
Best Answer chosen by Priya 777
Suraj TripathiSuraj Tripathi
Hi Priya,

This is the test class for your trigger, You can use it,
 
@isTest
private class TestDCS {
@isTest public static void m1()
    {
        Account acc=new Account();
        acc.Name='test';
        acc.Current_Floor_Plan__c='abc';
        acc.Floorplan_Source2__c='abcd';
        acc.DCS_targeting_date__c=system.today();
        insert acc;
    }
}



Hope, It will be helpful for you, If it helps you, then please select  my answer as Best answer to Close this Question from unsolved threads,

Regards
Suraj