liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@isTest
private class ImprovedForecastTimeControllerTest {
 
    @isTest 
    static void TestMethod1() {
 
        List<User> users = [select Id,Name,LastName, FirstName from User];
 
        Opportunity opp = new Opportunity();
        opp.Name = 'Testname0801';
        opp.StageName = '目標';
        opp.Close_Forecasted_Date__c = Date.today();
        // opp.Close_Forecasted_Assume_Date__c = Date.today().addDays(2);
        opp.Opportunity_No__c = '0801';
        opp.CloseDate = Date.today().addDays(1);
        opp.Sales_assistant_name_text__c = users[0].Id;
        opp.Manager_name_text__c = users[0].Id;
        insert opp;
 
        InquiryPredictsDateChange__c ipd = new InquiryPredictsDateChange__c();
        ipd.Opportunity__c = opp.Id;
        ipd.Date_InAdvance_Delay__c = '提前';
        ipd.CloseDate__c = Date.today();
        ipd.Close_Forecasted_Date__c = Date.today();
        // ipd.Close_Forecasted_Assume_Date__c = Date.today();
        ipd.Predicted_date_ChangeReason__c = '20220801';
        ipd.Predicted_Date_Status__c = '已提交';
        ipd.Manager_name__c = users[0].Id;
        ipd.Sales_assistant_name__c = users[0].Id;
        insert ipd;
 
        String str = JSON.serialize(ipd);
 
        ImprovedForecastTimeController.OppInfo controller = new ImprovedForecastTimeController.OppInfo(ipd);
        ImprovedForecastTimeController.OppInfo controller1 = new ImprovedForecastTimeController.OppInfo(opp);
        ImprovedForecastTimeController.GetOppinformationcData(String.valueOf(opp.Id));
        ImprovedForecastTimeController.getReason();
        ImprovedForecastTimeController.SaveData(str);
 
    }
 
    @isTest 
    static void TestMethod2() {
 
        List<User> users = [select Id,Name,LastName, FirstName from User];
 
        Opportunity opp = new Opportunity();
        opp.Name = 'Testname0801';
        opp.StageName = '目標';
        opp.Close_Forecasted_Date__c = Date.today();
        // opp.Close_Forecasted_Assume_Date__c = Date.today().addDays(2);
        opp.Opportunity_No__c = '0801';
        opp.CloseDate = Date.today().addDays(1);
        opp.Sales_assistant_name_text__c = users[0].Id;
        opp.Manager_name_text__c = users[0].Id;
        insert opp;
 
        ImprovedForecastTimeController.OppInfo controller = new ImprovedForecastTimeController.OppInfo(opp);
        ImprovedForecastTimeController.GetOppinformationcData(String.valueOf(opp.Id));
 
    }
  
}