@isTest private class QuestionnaireAllowanceControllerTest { @isTest static void QuestionnaireInsert(){ QuestionnaireAllowanceController conTest = new QuestionnaireAllowanceController(); PageReference page = new PageReference('/apex/QuestionnaireAllowance'); page.setRedirect(true); System.Test.setCurrentPage(page); conTest.init(); //1 conTest.save(); //2 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.save(); //3 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.save(); //3 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.save(); //3 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 333; conTest.save(); //4 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.save(); //5 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.save(); //6 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.save(); //7 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.TeamWork_efficiency__c = '①上升'; conTest.save(); //8 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.TeamWork_efficiency__c = '①上升'; conTest.csc.TeamWork_efficiency_Text__c = '①上升'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.save(); //9 conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.save(); } @isTest static void QuestionnaireInsert3(){ QuestionnaireAllowanceController conTest = new QuestionnaireAllowanceController(); PageReference page = new PageReference('/apex/QuestionnaireAllowance'); page.setRedirect(true); System.Test.setCurrentPage(page); conTest.init(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.csc.Traffic_subsidy_balance__c = 222; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.csc.Traffic_subsidy_balance__c = 222; conTest.csc.Most_satisfied__c = 'Test'; conTest.save(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.csc.Traffic_subsidy_balance__c = 222; conTest.csc.Most_satisfied__c = 'Test'; conTest.csc.Most_dissatisfied__c = 'Test'; conTest.save(); } @isTest static void QuestionnaireInsert4(){ QuestionnaireAllowanceController conTest = new QuestionnaireAllowanceController(); PageReference page = new PageReference('/apex/QuestionnaireAllowance'); page.setRedirect(true); System.Test.setCurrentPage(page); conTest.init(); conTest.csc.Incharge_Hospital_Count__c = '①5家以下'; conTest.csc.Incharge_Hospital_Location__c = '③ 全部是市内医院'; conTest.csc.Incharge_Hospital_FarthestDistance__c = 222; conTest.csc.Incharge_Hospital_NearestDistance__c = 111; conTest.csc.Trip_Mode__c = '①出租车'; conTest.csc.Trip_Mode_Other__c = 'Test'; conTest.csc.Visit_efficiency_quality__c = '①上升'; conTest.csc.Visit_efficiency_quality_Text__c = '①上升'; conTest.csc.Other_Visitefficiency__c = '①上升'; conTest.csc.Other_Visitefficiency_Text__c = '①上升'; conTest.csc.Workeffectiveness_departments__c = '①上升'; conTest.csc.Workeffectiveness_departments_Text__c = '①上升'; conTest.csc.Traffic_subsidy_Status__c = '①完全满足'; conTest.csc.Traffic_subsidy_balance__c = 222; conTest.csc.Most_satisfied__c = 'Test'; conTest.csc.Most_dissatisfied__c = 'Test'; conTest.csc.Accept_traffic__c = '①每月实报实销'; conTest.csc.Traffic_expense_reason__c = 'Test'; conTest.csc.Accept_GPS__c = '①能接受'; conTest.csc.Traffic_subsidy_Opinion__c = 'Test'; conTest.csc.TeamWork_efficiency__c = '①上升'; conTest.csc.TeamWork_efficiency_Text__c = '①上升'; conTest.save(); List qsList = [select id,name from Questionnaire_Survey__c]; System.assertEquals(1, qsList.size()); conTest.Sorder(); } }