@isTest
|
private class DateModifyControllerTest {
|
|
@isTest static void test_method_one() {
|
list<Campaign> Campaignlist = new list<Campaign>();
|
Campaign cam = new Campaign();
|
cam.Name = 'cam';
|
cam.StartDate = Date.today().addDays(15);
|
cam.EndDate = Date.today().addDays(18);
|
cam.Name2__c = '1234';
|
cam.Status = '公开中';
|
cam.IsOpenCeremony__c = '是';
|
cam.CeremonyDate__c = Date.today();
|
|
cam.CeremonyDate_copy__c = Date.today().addDays(15);
|
|
cam.CeremonyLeaders__c = '123';
|
Campaignlist.add(cam);
|
|
|
Campaign cam1 = new Campaign();
|
cam1.Name = 'cam';
|
cam1.StartDate = Date.today().addDays(15);
|
cam1.EndDate = Date.today().addDays(18);
|
cam1.Name2__c = '1234';
|
cam1.Status = '公开中';
|
cam1.IsOpenCeremony__c = '否';
|
Campaignlist.add(cam1);
|
|
Campaign cam2 = new Campaign();
|
cam2.Name = 'cam';
|
cam2.StartDate = Date.today().addDays(15);
|
cam2.EndDate = Date.today().addDays(18);
|
cam2.CeremonyDate_copy__c = Date.today().addDays(15);
|
cam2.Name2__c = '1234';
|
cam2.Status = '公开中';
|
cam2.IsOpenCeremony__c = '否';
|
Campaignlist.add(cam2);
|
|
Campaign cam3 = new Campaign();
|
cam3.Name = 'cam';
|
cam3.StartDate = Date.today().addDays(15);
|
cam3.EndDate = Date.today().addDays(18);
|
cam3.CeremonyDate_copy__c = Date.today().addDays(15);
|
cam3.Name2__c = '1234';
|
cam3.Status = '公开中';
|
cam3.IsOpenCeremony__c = '否';
|
Campaignlist.add(cam3);
|
|
Campaign cam4 = new Campaign();
|
cam4.Name = 'cam';
|
cam4.StartDate = Date.today().addDays(15);
|
cam4.EndDate = Date.today().addDays(18);
|
cam4.CeremonyDate_copy__c = Date.today().addDays(18);
|
cam4.Name2__c = '1234';
|
cam4.Status = '公开中';
|
cam4.IsOpenCeremony__c = '否';
|
Campaignlist.add(cam4);
|
|
Campaign cam5 = new Campaign();
|
cam5.Name = 'cam';
|
cam5.StartDate = Date.today().addDays(15);
|
cam5.EndDate = Date.today().addDays(18);
|
cam5.Name2__c = '1234';
|
cam5.Status = '公开中';
|
cam5.IsOpenCeremony__c = '是';
|
cam5.CeremonyDate__c = Date.today();
|
cam5.CeremonyDate_copy__c = Date.today().addDays(15);
|
|
cam5.CeremonyLeaders__c = '123';
|
Campaignlist.add(cam5);
|
insert Campaignlist;
|
|
|
DateModifyController d = new DateModifyController();
|
d.coId = cam.id;
|
d.init();
|
d.saveBtn();
|
d.submitBtn();
|
|
DateModifyController d1 = new DateModifyController();
|
d1.coId = cam1.id;
|
d1.init();
|
d1.saveBtn();
|
d1.submitBtn();
|
|
DateModifyController d2 = new DateModifyController();
|
d2.coId = cam2.id;
|
d2.init();
|
d2.saveBtn();
|
d2.submitBtn();
|
System.Test.startTest();
|
DateModifyController d3 = new DateModifyController();
|
d3.coId = cam3.id;
|
d3.init();
|
d3.saveBtn();
|
d3.submitBtn();
|
|
DateModifyController d4 = new DateModifyController();
|
d4.coId = cam4.id;
|
d4.init();
|
d4.saveBtn();
|
d4.submitBtn();
|
|
|
DateModifyController d5 = new DateModifyController();
|
d5.coId = cam5.id;
|
d5.init();
|
d5.saveBtn();
|
d5.submitBtn();
|
System.Test.stopTest();
|
}
|
@isTest static void testsetUpEmailStr() {
|
Campaign cam = new Campaign();
|
cam.Name = 'cam';
|
cam.StartDate__c = Date.today().addDays(15);
|
cam.CeremonyDate_copy__c = Date.today().addDays(13);
|
|
|
cam.Lesson1Date__c = Date.today().addDays(15);
|
cam.Lesson1Date_copy__c = Date.today().addDays(13);
|
|
cam.Lesson2Date__c = Date.today().addDays(15);
|
cam.Lesson2Date_copy__c = Date.today().addDays(13);
|
|
cam.Lesson3Date__c = Date.today().addDays(15);
|
cam.Lesson3Date_copy__c = Date.today().addDays(13);
|
|
|
cam.Lesson4Date__c = Date.today().addDays(15);
|
cam.Lesson4Date_copy__c = Date.today().addDays(13);
|
|
|
cam.Lesson5Date__c = Date.today().addDays(15);
|
cam.Lesson5Date_copy__c = Date.today().addDays(13);
|
|
cam.Lesson6Date__c = Date.today().addDays(15);
|
cam.Lesson6Date_copy__c = Date.today().addDays(13);
|
|
cam.Lesson7Date__c = Date.today().addDays(15);
|
cam.Lesson7Date_copy__c = Date.today().addDays(13);
|
|
cam.Lesson8Date__c = Date.today().addDays(15);
|
cam.Lesson8Date_copy__c = Date.today().addDays(13);
|
|
|
cam.FinalExamDate__c = Date.today().addDays(15);
|
cam.FinalExamDate_copy__c = Date.today().addDays(13);
|
|
DateModifyController d = new DateModifyController();
|
d.cam = cam;
|
d.setUpEmailStr();
|
}
|
|
}
|