From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:56:14 +0800
Subject: [PATCH] lex community
---
force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls | 98 ++++++++++++++++++++----------------------------
1 files changed, 41 insertions(+), 57 deletions(-)
diff --git a/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls b/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
index 0ad62f6..60ceee1 100644
--- a/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
+++ b/force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
@@ -1,64 +1,51 @@
@isTest
private class DealerInquiryModifyStateControllerTest {
- @TestSetup
- static void init() {
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
+ @TestSetup static void init() {
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
}
- List<RecordType> rectSct = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
- ];
+ List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
if (rectSct.size() == 0) {
return;
}
- List<RecordType> rectDpt = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '瑷虹檪绉� 娑堝寲绉�'
- ];
+ List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 娑堝寲绉�'];
if (rectDpt.size() == 0) {
return;
}
// 銉嗐偣銉堛儑銉笺偪
-
+
Account company = new Account();
company.RecordTypeId = rectCo[0].Id;
- company.Name = 'NFM007TestCompany';
+ company.Name = 'NFM007TestCompany';
insert company;
Account section = new Account();
section.RecordTypeId = rectSct[0].Id;
- section.Name = '*';
+ section.Name = '*';
section.Department_Class_Label__c = '娑堝寲绉�';
- section.ParentId = company.Id;
+ section.ParentId = company.Id;
section.Hospital_Department_Class__c = company.Id;
insert section;
// Test.startTest();
Account depart = new Account();
depart.RecordTypeId = rectDpt[0].Id;
- depart.Name = '*';
- depart.Department_Name__c = 'NFM007TestDepart';
- depart.ParentId = section.Id;
+ depart.Name = '*';
+ depart.Department_Name__c = 'NFM007TestDepart';
+ depart.ParentId = section.Id;
depart.Department_Class__c = section.Id;
- depart.Hospital__c = company.Id;
+ depart.Hospital__c = company.Id;
insert depart;
Opportunity opp = new Opportunity();
- opp.AccountId = depart.Id;
+ opp.AccountId = depart.Id;
opp.Department_Class__c = section.Id;
- opp.Hospital__c = company.Id;
- opp.SAP_Send_OK__c = false;
- opp.Name = 'GZ-SP-NFM007_1';
- opp.Trade__c = '鍐呰部';
- opp.StageName = '寮曞悎';
- opp.CloseDate = Date.today();
+ opp.Hospital__c = company.Id;
+ opp.SAP_Send_OK__c = false;
+ opp.Name = 'GZ-SP-NFM007_1';
+ opp.Trade__c = '鍐呰部';
+ opp.StageName = '寮曞悎';
+ opp.CloseDate = Date.today();
opp.Stock_apply_status__c = '鐢宠涓�';
insert opp;
Test.startTest();
@@ -73,16 +60,17 @@
contact1.LastName = 'test1鍖婚櫌';
contact1.Agency_User__c = true;
insert contact1;
- List<Contact> contactlist = [
- SELECT Id, FirstName
- FROM Contact
- ];
+ List<Contact> contactlist = [select Id, FirstName
+ from Contact
+ ];
System.assertEquals('璨换鑰�', contactlist[0].FirstName);
+
+
//
User user = new User();
- Profile p = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
+ Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
user.ProfileId = p.Id;
user.ContactId = contact1.Id;
user.FirstName = '銉︺兗銈躲兗';
@@ -96,14 +84,10 @@
user.Alias = '銉嗐儲';
user.CommunityNickname = '銉嗐偣銉堛儲銉笺偠銉�';
user.SalesManager__c = UserInfo.getUserId();
- System.runAs(new User(Id = UserInfo.getUserId())) {
+ System.runAs(new User(Id = UserInfo.getUserId())){
insert user;
}
- List<user> users = [
- SELECT Id, Name, LastName, FirstName
- FROM User
- WHERE LastName = '銉嗐偣銉�'
- ];
+ List<user> users = [select Id, Name, LastName, FirstName from User where LastName = '銉嗐偣銉�'];
//
Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
@@ -116,14 +100,9 @@
//
//System.assertEquals('銉嗐偣銉�',users[0].LastName);
- System.assertEquals('銉︺兗銈躲兗', users[0].FirstName);
+ System.assertEquals('銉︺兗銈躲兗', users[0].FirstName );
- Id rtId = [
- SELECT Id, DeveloperName
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Agency_Opportunity__c' AND DeveloperName = 'Opportunity'
- ]
- .Id;
+ Id rtId = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Agency_Opportunity__c' and DeveloperName = 'Opportunity'].Id;
// Schema.SobjectType.Agency_Opportunity__c.getRecordTypeInfosByName().get('璇环').getRecordTypeId();
Agency_opportunity__c agency_opportunity = new Agency_opportunity__c();
agency_opportunity.RecordTypeId = rtId;
@@ -134,22 +113,25 @@
agency_opportunity.StageName__c = '杩樻病鐢宠棰勭畻';
agency_opportunity.OwnerId = user.Id;
agency_opportunity.Change_To_Opportunity_T__c = '::CF-HQ290I';
- agency_opportunity.Sales_Manager__c = UserInfo.getUserId();
+ agency_opportunity.Sales_Manager__c =UserInfo.getUserId();
insert agency_opportunity;
Test.stopTest();
+
}
static testMethod void myUnitTest_SortKey() {
- Test.startTest();
+ Test.startTest();
Test.setMock(WebServiceMock.class, new NFMTest_Mock());
Test.stopTest();
PageReference page = new PageReference('/apex/DealerInquiryModifyState');
System.Test.setCurrentPage(page);
+
// 鍒濆鍖栨祴璇�
DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
-
+
+
controller.init();
//System.assertEquals(1, controller.oppRecords.size());楠岃瘉棰勬湡鍊煎拰缁撴灉鍊兼纭��
// 鎺掑簭娴嬭瘯
@@ -164,7 +146,7 @@
// Test.stopTest();
}
static testMethod void myUnitTest_AccSearchAndAoosearch() {
- Test.startTest();
+ Test.startTest();
Test.setMock(WebServiceMock.class, new NFMTest_Mock());
Test.stopTest();
PageReference page = new PageReference('/apex/DealerInquiryModifyState');
@@ -172,7 +154,7 @@
DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
// 鍒濆鍖栨祴璇�
// Test.startTest();
-
+
controller.init();
//鏂囨湰杈撳叆妗嗘绱�
//1:缁忛攢鍟嗗尰闄�
@@ -361,7 +343,8 @@
controller.chick();
controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
controller.chick();
- Test.stopTest();
+ Test.stopTest();
+
}
static testMethod void myUnitTestTime02() {
PageReference page = new PageReference('/apex/DealerInquiryModifyState');
@@ -396,6 +379,7 @@
controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
controller.chick();
Test.stopTest();
+
}
static testMethod void myUnitTestTimeSave() {
PageReference page = new PageReference('/apex/DealerInquiryModifyState');
@@ -434,4 +418,4 @@
controller.init();
Test.stopTest();
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.1