From 5835379ec30b1667c4e522db9d294c9b7bb8633a Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 26 四月 2022 12:00:31 +0800
Subject: [PATCH] SSBG Back up
---
force-app/main/default/classes/ProRegisterBatchTest.cls | 63 +++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 13 deletions(-)
diff --git a/force-app/main/default/classes/ProRegisterBatchTest.cls b/force-app/main/default/classes/ProRegisterBatchTest.cls
index 13c252a..ba40bc1 100644
--- a/force-app/main/default/classes/ProRegisterBatchTest.cls
+++ b/force-app/main/default/classes/ProRegisterBatchTest.cls
@@ -1,17 +1,54 @@
@isTest
-public class ProRegisterBatchTest {
- static testMethod void Test01(){
- Product_Register__c PRC = new Product_Register__c();
- PRC.Name = '鍥芥娉ㄨ繘20183222249';
- PRC.MedPrdClass__c = '3';
- PRC.RegisterNoClass_New__c = '';
- PRC.RegisterNoClass_Old__c = '6822';
- PRC.PrdCompanyAddr__c = '鍚嶇О:濂ユ灄宸存柉鍖荤枟鏍紡浼氱ぞ;浣忔墍:鏃ユ湰鍥戒笢浜兘娑╄胺鍖哄埂涔嬭胺浜屼竵鐩�43鐣湴2鍙�;鑱旂郴鏂瑰紡:0081-426-42-2667';
- PRC.RegisterNoStatus__c = '鏈夋晥';
- PRC.ValidTo__c = Date.today();
- insert PRC;
+private class ProRegisterBatchTest {
+ static testMethod void testMethod1() {
- Id execBTId = Database.executeBatch(new ProRegisterBatch(), 100);
- execBTId = Database.executeBatch(new ProRegisterBatch(PRC.Id), 100);
+ Product_Register__c prorec = new Product_Register__c();
+ prorec.Name = 'SFDCTEST2018001';
+ prorec.MedPrdClass__c = '3';
+ prorec.RegisterNoClass_New__c = '';
+ prorec.RegisterNoClass_Old__c = '6822';
+ prorec.PrdCompanyAddr__c = '鍚嶇О:濂ユ灄宸存柉鍖荤枟鏍紡浼氱ぞ;浣忔墍:鏃ユ湰鍥戒笢浜兘娑╄胺鍖哄埂涔嬭胺浜屼竵鐩�43鐣湴2鍙�;鑱旂郴鏂瑰紡:0081-426-42-2667';
+ prorec.ValidTo__c = Date.today().addDays(-1);
+ prorec.ValidFrom__c = Date.today().addDays(-22);
+ insert prorec;
+ Product_Register__c prorec1 = new Product_Register__c();
+ prorec1.Name = 'SFDCTEST2018002';
+ prorec1.MedPrdClass__c = '3';
+ prorec1.RegisterNoClass_New__c = '';
+ prorec1.RegisterNoClass_Old__c = '6822';
+ prorec1.PrdCompanyAddr__c = '鍚嶇О:濂ユ灄宸存柉鍖荤枟鏍紡浼氱ぞ;浣忔墍:鏃ユ湰鍥戒笢浜兘娑╄胺鍖哄埂涔嬭胺浜屼竵鐩�43鐣湴2鍙�;鑱旂郴鏂瑰紡:0081-426-42-2667';
+ prorec1.ValidTo__c = Date.today().addDays(1);
+ prorec1.ValidFrom__c = Date.today().addDays(-22);
+ insert prorec1;
+ List<Product_Register__c> prorecList = [select Id, Name, ValidProductRegister__c from Product_Register__c ];
+ System.assertEquals(false, prorecList[0].ValidProductRegister__c);
+
+ Product2 pro = new Product2();
+ pro.Name = 'A00507A:瀵嗗皝鍦�, 閫忔槑, 榛戣壊';
+ pro.registrationCode__c = 'SFDCTEST2018001 SFDCTEST2018002';
+ insert pro;
+
+ Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID);
+ prl.Product2__c = pro.ID;
+ insert prl;
+
+ Product_Register_Link__c prl2 = new Product_Register_Link__c(Product_Register__c = prorec1.ID);
+ prl2.Product2__c = pro.ID;
+ insert prl2;
+
+ Id execBTId = null;
+ System.Test.StartTest();
+ execBTId = Database.executeBatch(new ProRegisterBatch());
+ List<Product2> productList = [select Id, registrationCode__c from Product2];
+ System.assertEquals('SFDCTEST2018002', productList[0].registrationCode__c);
+ execBTId = Database.executeBatch(new ProRegisterBatch('updateAllInvalidData'));
+ productList = [select Id, registrationCode__c from Product2];
+ System.assertEquals('SFDCTEST2018002', productList[0].registrationCode__c);
+ String prorecId = prorec.ID;
+ execBTId = Database.executeBatch(new ProRegisterBatch(prorecId));
+ productList = [select Id, registrationCode__c from Product2];
+ System.assertEquals('SFDCTEST2018002', productList[0].registrationCode__c);
+ System.Test.StopTest();
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1