From 1312ba82d4c880bdb5357d28e0d4af5b285f610f Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期四, 10 三月 2022 15:54:39 +0800
Subject: [PATCH] 最近一月修改内容

---
 force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls |   87 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls b/force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls
index b90d3af..11d7e53 100644
--- a/force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls
+++ b/force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls
@@ -1,6 +1,93 @@
 @isTest
 private class BatchSelectRepairPageControllerTest {
+    static Repair__c repair01;
+    public static void init(){
+        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
+        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+        insert hpOwner;
+        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
+        if (rectDpt.size() == 0) {
+            return;
+        }
+        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'SoakupTestHp', OwnerId = hpOwner.Id);
+        insert hp;
+        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+        dpt.Name         = '*';
+        dpt.Department_Name__c  = 'TestDepart';
+        dpt.ParentId            = dc.Id;
+        dpt.Department_Class__c = dc.Id;
+        dpt.Hospital__c         = hp.Id;
+        insert dpt;
+        Asset asset = new Asset();
+        asset.Name = '銉嗐偣銉堟鍣�';
+        asset.AccountId = dpt.Id;
+        asset.Department_Class__c = dc.Id;
+        asset.Hospital__c = hp.Id;
+        asset.SerialNumber = 'testserial';
+        insert asset;
+    
+        repair01 = new Repair__c();
+        repair01.Account__c = dpt.Id;
+        repair01.Department_Class__c = dc.Id;
+        repair01.Hospital__c = hp.Id;
+        repair01.Delivered_Product__c = asset.Id;
+        repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays(0); 
+        repair01.FSE_Work_Location__c = '涓婃捣';
+        repair01.Incharge_Staff__c = hpOwner.Id;
+        // repair01.Final_complete_day__c = Date.today().addDays(-1);
+        insert repair01;
+    }
     static testMethod void testSample_01() {
+        init();
+        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
+        System.Test.setCurrentPage(page);
+        System.Test.StartTest();
+        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
+        br.init();
 
+        br.RevalInfoList[0].repair = repair01;
+        br.RevalInfoList[0].Status2 = '01.鍒嗗叕鍙稿彈鐞嗗畬姣�';
+        br.RevalInfoList[0].RepairName = 'RS-202203-651844';
+        br.RevalInfoList[0].SerialNumber = 'testserial';
+        // br.RevalInfoList[0].SAPRepairNo = '000010201157';
+        br.RetrievalBtn();
+
+        br.RAInfoList[0].IFCheck = true;
+        br.showPDF();          
+        System.Test.StopTest();
+
+    }
+    static testMethod void testSample_02() {
+        init();
+        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
+        System.Test.setCurrentPage(page);
+        System.Test.StartTest();
+        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
+        br.init();
+        br.RetrievalBtn();
+        System.Test.StopTest();
+    }
+    static testMethod void testSample_03() {
+        init();
+        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
+        System.Test.setCurrentPage(page);
+        System.Test.StartTest();
+        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
+        br.init();
+        br.RevalInfoList[0].Status2 = '012312';
+        br.RetrievalBtn();
+        System.Test.StopTest();
+    }
+    static testMethod void testSample_04() {
+        init();
+        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
+        System.Test.setCurrentPage(page);
+        System.Test.StartTest();
+        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
+        br.init();
+        br.showPDF();
+        System.Test.StopTest();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1