@isTest
private class SortUpdateOpp2BatchTest {

    static testMethod void Method01() {
        StaticParameter.EscapeOppandStaTrigger = true;

        opp2AuxiliarySort__c oas1 = new opp2AuxiliarySort__c();
        oas1.Name = '1.华北';
        oas1.type__c = 2;
        insert oas1;

        Opportunity opp1 = new Opportunity();
        opp1.Name = 'aiueo';
        opp1.StageName = '引合';
        opp1.Trade__c = '内貿';
        opp1.SAP_Send_OK__c = false;
        opp1.Wholesale_Price__c = 101;
        opp1.Tax_Intra_F_Copy__c = 1;
        opp1.Opportunity_Category__c = 'GI';
        opp1.OCM_man_province_cus_txt__c = '北京';
        opp1.CloseDate = Date.today();
        insert opp1;

        Opportunity2__c o2pp1 = new Opportunity2__c();
        o2pp1.Opportunity__c = opp1.Id;
        insert o2pp1;
    
        List<String> str = new List<String>();
        str.add('1.华北');
        Database.executeBatch(new SortUpdateOpp2Batch(str),1);
    }

    static testMethod void Method02() {
        StaticParameter.EscapeOppandStaTrigger = true;

        opp2AuxiliarySort__c oas2 = new opp2AuxiliarySort__c();
        oas2.Name = '全国';
        oas2.type__c = 3;
        insert oas2;

        Opportunity opp2 = new Opportunity();
        opp2.Name = 'aiueo';
        opp2.StageName = '引合';
        opp2.Trade__c = '内貿';
        opp2.SAP_Send_OK__c = false;
        opp2.Wholesale_Price__c = 101;
        opp2.Tax_Intra_F_Copy__c = 1;
        opp2.Opportunity_Category__c = 'OTH';
        opp2.OCM_man_province_cus_txt__c = '北京';
        opp2.CloseDate = Date.today();
        insert opp2;

        Opportunity2__c o2pp2 = new Opportunity2__c();
        o2pp2.Opportunity__c = opp2.Id;
        insert o2pp2;

        Database.executeBatch(new SortUpdateOpp2Batch(),1);
    }

    static testMethod void Method03() {
        StaticParameter.EscapeOppandStaTrigger = true;

        opp2AuxiliarySort__c oas2 = new opp2AuxiliarySort__c();
        oas2.Name = '全国';
        oas2.type__c = 1;
        insert oas2;

        Opportunity opp2 = new Opportunity();
        opp2.Name = 'aiueo';
        opp2.StageName = '引合';
        opp2.Trade__c = '内貿';
        opp2.SAP_Send_OK__c = false;
        opp2.Wholesale_Price__c = 101;
        opp2.Tax_Intra_F_Copy__c = 1;
        opp2.Opportunity_Category__c = 'OTH';
        opp2.OCM_man_province_cus_txt__c = '北京';
        opp2.CloseDate = Date.today();
        insert opp2;

        Opportunity2__c o2pp2 = new Opportunity2__c();
        o2pp2.Opportunity__c = opp2.Id;
        insert o2pp2;

        Database.executeBatch(new SortUpdateOpp2Batch(),1);
    }
}