高章伟
2022-03-10 1312ba82d4c880bdb5357d28e0d4af5b285f610f
force-app/main/default/classes/InquiryVerifyBatchTest.cls
@@ -21,15 +21,14 @@
    private static Date createdDateStr = Date.today();
    static testMethod void testMethod1() {
        System.Test.StartTest();
        InitData();
        // System.Test.StartTest();
        // try {
            ID exid = Database.executeBatch(new InquiryVerifyBatch(),1);
            // System.abortJob(exid);
        // } catch(Exception e){
        // }
            // System.Test.StopTest();
        ID exid = Database.executeBatch(new InquiryVerifyBatch(),1);
        InquiryVerifyBatch bct1 = new InquiryVerifyBatch(null,null);
        System.schedule('Scheduled Job 5', '0 45 * * * ?', bct1);
        System.Test.StopTest();
    }
    private static void InitData() {
@@ -163,9 +162,11 @@
            prd1.Category4__c = 'CV';
            prd1.Category5__c = '260SL系列';
            prd1.Asset_Model_No__c = '1001';
            prd1.Important_product__c = true;
            prd1.Important_Rroduct_1GI__c = true;
            insert prd1;
            System.assertEquals(prd1.Important_product__c,true);
            PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
            entry.UnitPrice = 0;
@@ -173,7 +174,7 @@
            entry.UseStandardPrice = false;
            entry.CurrencyIsoCode = 'CNY';
            insert entry;
            System.assertEquals(prd1.Important_product__c,true);
            List<Quote> qList = [Select Id, CurrencyIsoCode from Quote where Id = : quote.Id];
            System.assertEquals(1, qList.size());
            System.assertEquals('CNY', qList[0].CurrencyIsoCode);
@@ -189,7 +190,14 @@
            target.Product2Id = prd1.id;
            target.PricebookEntryId = entry.Id;
            insert target;
            prd1.Important_product__c = true;
            update prd1;
            System.assertEquals(prd1.Important_product__c,true);
            // System.assertEquals(target.Product2.Important_product__c,true);
            system.assertEquals(target.Product2Id,prd1.id);
            List<QuoteLineItem> qlts = [Select Id,Product2.Important_product__c,QuoteId from QuoteLineItem where id = :target.id];
            System.assertEquals(qlts[0].Product2.Important_product__c,true);
            System.assertEquals(qlts[0].QuoteId,quote.id);
            Consumable_order_details2__c saledet1 = new Consumable_order_details2__c();
            saledet1.Name = 'OCM_01_001001';
            // saledet1.Consumable_order_minor__c = Order1.Id;