@isTest
private class RepairTriggerHandlerTest {
    
    static testMethod void myUnitTest() {
        OlympusCalendar__c oc1 = new OlympusCalendar__c(Date__c = Date.today().addDays(1), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc2 = new OlympusCalendar__c(Date__c = Date.today().addDays(2), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc3 = new OlympusCalendar__c(Date__c = Date.today().addDays(3), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc4 = new OlympusCalendar__c(Date__c = Date.today().addDays(4), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc5 = new OlympusCalendar__c(Date__c = Date.today().addDays(5), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc6 = new OlympusCalendar__c(Date__c = Date.today().addDays(6), ChangeToHoliday__c=true, ChangeToWorkday__c=false);
        OlympusCalendar__c oc7 = new OlympusCalendar__c(Date__c = Date.today().addDays(7), ChangeToHoliday__c=true, ChangeToWorkday__c=false);
        OlympusCalendar__c oc8 = new OlympusCalendar__c(Date__c = Date.today().addDays(8), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc9 = new OlympusCalendar__c(Date__c = Date.today().addDays(9), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc10 = new OlympusCalendar__c(Date__c = Date.today().addDays(10), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc11 = new OlympusCalendar__c(Date__c = Date.today().addDays(11), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc12 = new OlympusCalendar__c(Date__c = Date.today().addDays(12), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc13 = new OlympusCalendar__c(Date__c = Date.today().addDays(-1), ChangeToHoliday__c=true, ChangeToWorkday__c=false);
        OlympusCalendar__c oc14 = new OlympusCalendar__c(Date__c = Date.today().addDays(-2), ChangeToHoliday__c=true, ChangeToWorkday__c=false);
        OlympusCalendar__c oc15 = new OlympusCalendar__c(Date__c = Date.today().addDays(-3), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc16 = new OlympusCalendar__c(Date__c = Date.today().addDays(-4), ChangeToHoliday__c=false, ChangeToWorkday__c=true);
        OlympusCalendar__c oc17 = new OlympusCalendar__c(Date__c = Date.today().addDays(-5), ChangeToHoliday__c=false, ChangeToWorkday__c=true);

        insert new OlympusCalendar__c[] {oc1,oc2,oc3,oc4,oc5,oc6,oc7,oc8,oc9,oc10,oc11,oc12,oc13,oc14,oc15,oc16,oc17};

        
        Repair__c rep1 = new Repair__c();
        rep1.Name='test';
        rep1.ServicePlace__c='现场';
        
        insert rep1;
        rep1.ServiceStartDate__c=Date.today().addDays(6);
        rep1.CustomerRequestDate__c=Date.today().addDays(3);
        
        update rep1;
        
        rep1.ServiceType__c='维修';
        rep1.ServiceProperty__c ='有偿';
        
        update rep1;
        
        rep1.QuotationAgreeDate__c =Date.today().addDays(11);
        rep1.CompletionDate__c=Date.today().addDays(10);
        update rep1;
        
        rep1.ServiceProperty__c ='无偿';
        
        update rep1;
        
        rep1.ServiceStartDate__c = null;
        rep1.CompletionDate__c= null;
        update rep1;
        
        rep1.ServiceType__c=null;
        update rep1;
        
        rep1.ServiceType__c='维修';
        rep1.QuotationAgreeDate__c = null ;
        rep1.BugDate__c = Date.today().addDays(10);
        rep1.CompletionDate__c =Date.today().addDays(11);
        update rep1;
        
        rep1.QuotationDate__c = null;
        rep1.QuotationAgreeDate__c = null;
        rep1.BugDate__c = null; 
        rep1.CompletionDate__c = null;
        update rep1;
        
        rep1.QuotationDate__c = Date.today().addDays(9);
        rep1.QuotationAgreeDate__c =  Date.today().addDays(10);
        rep1.BugDate__c =  Date.today().addDays(1); 
        rep1.CompletionDate__c = Date.today().addDays(11);
        update rep1;   
        
        
        Repair__c rep = new Repair__c();
        rep.Name='test';
        rep.RecordTypeId = Schema.SObjectType.Repair__c.getRecordTypeInfosByDeveloperName().get('RVI').getRecordTypeId();     
        rep.ServicePlace__c='现场';
        insert rep;
        
        rep.ReciveRepairDay__c=Date.today().addDays(3);
        rep.QuotationAgreeDate__c=Date.today().addDays(6);
        update rep;
        
        rep.ServiceType__c='维修';
        update rep;
        
        rep.QuotationAgreeDate__c = Date.today().addDays(6) ;
        rep.CompletionDate__c =Date.today().addDays(11);
        update rep;
        
        rep.ServiceType__c='维护';
        rep.QuotationDate__c = Date.today().addDays(9) ;
        rep.QuotationAgreeDate__c = Date.today().addDays(10);
        rep.ReciveRepairDay__c = Date.today().addDays(1) ;
        rep.CompletionDate__c = Date.today().addDays(11);
        update rep;
                             
        
        
     
        
                  
    }

}