@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));
|
|
}
|
|
}
|