@isTest
|
private class BusinessActivityHandlerTest {
|
public static TS_Repair__c tsr;
|
public static TS_Repair__c tsr2;
|
public static BusinessActivity__c ba1;
|
public static BusinessActivity__c ba2;
|
public static BusinessActivity__c ba3;
|
public static BusinessActivity__c ba4;
|
|
public static User_FaultInfo__c uf1;
|
public static User_FaultInfo__c uf2;
|
public static User_FaultInfo__c uf3;
|
|
public static FailureAsset__c fa1;
|
public static FailureAsset__c fa2;
|
public static FailureAsset__c fa3;
|
static void basicData() {
|
|
tsr = new TS_Repair__c();
|
tsr.TSReportDate__c = Date.today();
|
tsr.TSRepairManagementCode__c = 'TestName';
|
insert tsr;
|
tsr2 = new TS_Repair__c();
|
tsr2.TSReportDate__c = Date.today();
|
insert tsr2;
|
|
uf1 = new User_FaultInfo__c();
|
insert uf1;
|
fa1 = new FailureAsset__c();
|
fa1.model__c = 'test1';
|
fa1.FAUserFaultInfo__c = uf1.Id;
|
insert fa1;
|
ba1 = new BusinessActivity__c();
|
ba1.BusinessATS__c = tsr.Id;
|
ba1.workingHours__c = 2;
|
ba1.BusinessAApprovalOpinion__c = '同意';
|
ba1.User_FaultInfo__c = uf1.Id;
|
ba1.AgreeReportDate__c = Date.today().addDays(-2);//报告日期(后台用)
|
ba1.BusinessADateRequest__c = Date.today().addDays(-3);//要求服务日期
|
ba1.BusinessACompletionDate__c = Date.today().addDays(-2);//案件完成日
|
ba1.BusinessADateApproval__c= Date.today().addDays(-2);//同意报价日期
|
ba1.BusinessADateQuotation__c= Date.today().addDays(-2);// 报价日期
|
ba1.BusinessARepairDate__c= Date.today().addDays(-2);//报修日期
|
ba1.BusinessASegment__c = 'LS';
|
ba1.BusinessAServicePlace__c = '现场';
|
ba1.serviceType__c = '硬件修理';
|
ba1.BusinessAServiceCategory__c = 'Repair';
|
|
ba1.BusinessANatureService__c = '有偿';
|
ba1.BusinessAFirstSubmission__c = Datetime.now();
|
insert ba1;
|
|
ba4 = new BusinessActivity__c();
|
ba4.BusinessATS__c = tsr.Id;
|
ba4.workingHours__c = 7;
|
ba4.BusinessAApprovalOpinion__c = '';
|
ba4.User_FaultInfo__c = uf1.Id;
|
|
ba4.AgreeReportDate__c = Date.today().addDays(1);//报告日期(后台用)
|
ba4.BusinessADateRequest__c = Date.today().addDays(2);//要求服务日期
|
ba4.BusinessACompletionDate__c = Date.today().addDays(1);//案件完成日
|
ba4.BusinessADateApproval__c= Date.today().addDays(4);//同意报价日期
|
ba4.BusinessADateQuotation__c= Date.today().addDays(1);// 报价日期
|
ba4.BusinessARepairDate__c= Date.today().addDays(-3);//报修日期
|
ba4.BusinessASegment__c = 'LS';
|
ba4.BusinessAServicePlace__c = '现场';
|
ba4.serviceType__c = '硬件修理';
|
ba4.BusinessAServiceCategory__c = 'Repair';
|
|
ba4.BusinessANatureService__c = '无偿';
|
ba4.BusinessAFirstSubmission__c = Datetime.now();
|
insert ba4;
|
|
|
BusinessActivity__c ba5 = new BusinessActivity__c();
|
ba5.FindManagementCode__c = 'TestName';
|
ba5.BusinessATS__c = tsr.Id;
|
ba5.workingHours__c = 7;
|
ba5.BusinessAApprovalOpinion__c = '';
|
ba5.User_FaultInfo__c = uf1.Id;
|
ba5.BusinessASegment__c = 'RVI';
|
ba5.serviceType__c = '产品安装';
|
ba5.BusinessAServiceCategory__c = 'Sevice';
|
|
insert ba5;
|
update ba5;
|
BusinessActivity__c ba6 = ba5.clone();
|
ba6.BusinessASegment__c = 'LS';
|
ba6.BusinessAServicePlace__c = '现场';
|
ba6.serviceType__c = '硬件修理';
|
ba6.BusinessAServiceCategory__c = 'Repair';
|
|
ba6.BusinessANatureService__c = '有偿';
|
insert ba6;
|
|
delete ba6;
|
// uf2 = new User_FaultInfo__c();
|
// insert uf2;
|
// fa2 = new FailureAsset__c();
|
// fa2.model__c = 'test2';
|
// fa2.FAUserFaultInfo__c = uf2.Id;
|
// insert fa2;
|
// ba2 = new BusinessActivity__c();
|
// ba2.BusinessATS__c = tsr2.Id;
|
// ba2.workingHours__c = 2;
|
// ba2.User_FaultInfo__c = uf2.Id;
|
// insert ba2;
|
|
// uf3 = new User_FaultInfo__c();
|
// insert uf3;
|
// fa3 = new FailureAsset__c();
|
// fa3.model__c = 'test3';
|
// fa3.FAUserFaultInfo__c = uf3.Id;
|
// insert fa3;
|
// ba3 = new BusinessActivity__c();
|
// ba3.BusinessATS__c = tsr2.Id;
|
// ba3.workingHours__c = 2;
|
// ba3.User_FaultInfo__c = uf3.Id;
|
// insert ba3;
|
|
// Attachment att = new Attachment(
|
// Name = 'ORDER-123456.pdf',
|
// parentId = ba1.Id,
|
// Body = EncodingUtil.base64Decode('test')
|
// );
|
// insert att;
|
|
// Attachment att2 = new Attachment(
|
// Name = 'not-ORDER-123456.pdf',
|
// parentId = ba2.Id,
|
// Body = EncodingUtil.base64Decode('test')
|
// );
|
// insert att2;
|
|
}
|
static testMethod void testMethod1() {
|
basicData();
|
update uf1;
|
}
|
}
|