From 884f10a686d0c576209498a1e6573e7bee4fd172 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期二, 19 四月 2022 10:39:38 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlympusSSBG
---
force-app/main/default/classes/TydelikeConControllerTest.cls | 273 ++++++++----------------------------------------------
1 files changed, 42 insertions(+), 231 deletions(-)
diff --git a/force-app/main/default/classes/TydelikeConControllerTest.cls b/force-app/main/default/classes/TydelikeConControllerTest.cls
index 8691ac1..ba003d8 100644
--- a/force-app/main/default/classes/TydelikeConControllerTest.cls
+++ b/force-app/main/default/classes/TydelikeConControllerTest.cls
@@ -1,236 +1,47 @@
@isTest
-private class TydelikeConControllerTest {
+public class TydelikeConControllerTest {
static testMethod void testMethod1() {
- TydelikeAccount__c acc1 = new TydelikeAccount__c();
- acc1.name = '**';
- acc1.OwnerId = UserInfo.getUserId();
- acc1.TyCity__c = '鍖椾含';
- acc1.OfSkrap__c = false;
- acc1.TyAddress__c = '11111';
- acc1.TyPostCode__c = '123456';
- insert acc1;
+ Account acctest = TestDataUtility.CreateAccounts(1)[0];
+ acctest.ProductSegment__c = 'BS';
+ update acctest;
+
+ TydelikeContact__c tycotest = new TydelikeContact__c();
+ tycotest.Name = 'test';
+ tycotest.TyAddress__c = 'test';
+ tycotest.TyFaxD__c = 'test';
+ tycotest.TyPhoneD__c = '13566667777';
+ tycotest.TyPostcode__c = '5000000';
+ tycotest.EnglishAddress__c = 'test';
+ tycotest.ContactEnglishName__c = 'test';
+ insert tycotest;
+
+ TydelikeAccount__c tyaccount = new TydelikeAccount__c();
- TydelikeContact__c tycon1 = new TydelikeContact__c();
- tycon1.name = '*';
- tycon1.OfSkrap__c = false;
- tycon1.TydelikeAccount__c = acc1.Id;
- tycon1.TyAddress__c = '11111';
- tycon1.TyFaxD__c = '1111';
- tycon1.TyPhoneD__c = '15555555555';
- tycon1.TyPostcode__c = '111111';
- tycon1.EnglishAddress__c = '111111';
- tycon1.ContactEnglishName__c = '111111';
- insert tycon1;
- System.debug(tycon1);
-
- List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
- List<RecordType> rectBS = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
-
- Account buyer = new Account(
- Name = '*',
- FacilityName__c = 'buyer',
- PostCode__c = '123456',
- RecordTypeId = rectDealer[0].Id,
- ProductSegment__c = 'BS'
- );
- insert buyer;
- System.debug(buyer);
- /*Account accBS = new Account(
- Name = '12343',
- RecordTypeId = rectBS[0].Id,
- OwnerId = UserInfo.getUserId(),
- DivisionName_D__c = '010',
- FacilityNameD__c = '011',
- DepartmentNameD__c = '001',
- Province__c = '鍖椾含',
- CityD__c = 'beijing',
- Address1D__c = '7hao',
- UserType__c = 'OEM瀹㈡埛',
- MarketVerticalsD__c = 'Education',
- IndustryBD__c = 'Education',
- UseD__c = 'Education',
-
- DivisionName__c = '010',
- FacilityName__c = '011',
- DepartmentName__c = '001',
- City__c = 'beijing',
- Address1__c = '7hao',
- MarketVerticals__c = 'Education',
- IndustryB__c = 'Education',
- Use__c = 'Education',
- ProductSegment__c = 'BS'
- );
- insert accBS;
- System.debug(accBS);*/
-
- PageReference page = new PageReference('/apex/TydelikeCon?accName=' + buyer.Name + '&tyacId=' + acc1.Id + '&tycoId=' + tycon1.Id);
- System.Test.setCurrentPage(page);
- TydelikeConController controller = new TydelikeConController();
- controller.init();
- controller.save();
+ String url = ApexPages.currentPage().getParameters().put('accName',acctest.Name);
+ url = ApexPages.currentPage().getParameters().put('tycoId',tycotest.Id);
+ url = ApexPages.currentPage().getParameters().put('tyacId',tyaccount.Id);
+
+
+ Test.startTest();
+ TydelikeConController scc = new TydelikeConController();
+ scc.acc = acctest;
+ scc.tya = tyaccount;
+ scc.init();
+ scc.save();
+ acctest.ProductSegment__c = 'IE';
+ update acctest;
+ scc.init();
+ acctest.ProductSegment__c = 'NDT';
+ update acctest;
+ scc.init();
+ acctest.ProductSegment__c = 'ANI';
+ update acctest;
+ scc.init();
+ acctest.ProductSegment__c = 'RVI';
+ update acctest;
+ scc.init();
+ Test.stopTest();
}
-
- static testMethod void testMethod2() {
- TydelikeAccount__c acc1 = new TydelikeAccount__c();
- acc1.name = '**';
- acc1.OwnerId = UserInfo.getUserId();
- acc1.TyCity__c = '鍖椾含';
- acc1.OfSkrap__c = false;
- acc1.TyAddress__c = '11111';
- acc1.TyPostCode__c = '123456';
- insert acc1;
-
- TydelikeContact__c tycon1 = new TydelikeContact__c();
- tycon1.name = '*';
- tycon1.OfSkrap__c = false;
- tycon1.TydelikeAccount__c = acc1.Id;
- tycon1.TyAddress__c = '11111';
- tycon1.TyFaxD__c = '1111';
- tycon1.TyPhoneD__c = '15555555555';
- tycon1.TyPostcode__c = '111111';
- insert tycon1;
- System.debug(tycon1);
-
- List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
- List<RecordType> rectBS = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
-
- Account buyer = new Account(
- Name = '*',
- FacilityName__c = 'buyer',
- PostCode__c = '123456',
- RecordTypeId = rectDealer[0].Id,
- ProductSegment__c = 'IE'
- );
- insert buyer;
- System.debug(buyer);
-
- PageReference page = new PageReference('/apex/TydelikeCon?accName=' + buyer.Name + '&tyacId=' + acc1.Id + '&tycoId=' + tycon1.Id);
- System.Test.setCurrentPage(page);
- TydelikeConController controller = new TydelikeConController();
- controller.init();
- controller.save();
- }
-
- static testMethod void testMethod3() {
- TydelikeAccount__c acc1 = new TydelikeAccount__c();
- acc1.name = '**';
- acc1.OwnerId = UserInfo.getUserId();
- acc1.TyCity__c = '鍖椾含';
- acc1.OfSkrap__c = false;
- acc1.TyAddress__c = '11111';
- acc1.TyPostCode__c = '123456';
- insert acc1;
-
- TydelikeContact__c tycon1 = new TydelikeContact__c();
- tycon1.name = '*';
- tycon1.OfSkrap__c = false;
- tycon1.TydelikeAccount__c = acc1.Id;
- tycon1.TyAddress__c = '11111';
- tycon1.TyFaxD__c = '1111';
- tycon1.TyPhoneD__c = '15555555555';
- tycon1.TyPostcode__c = '111111';
- insert tycon1;
- System.debug(tycon1);
-
- List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
- List<RecordType> rectBS = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
-
- Account buyer = new Account(
- Name = '*',
- FacilityName__c = 'buyer',
- PostCode__c = '123456',
- RecordTypeId = rectDealer[0].Id,
- ProductSegment__c = 'NDT'
- );
- insert buyer;
- System.debug(buyer);
-
- PageReference page = new PageReference('/apex/TydelikeCon?accName=' + buyer.Name + '&tyacId=' + acc1.Id + '&tycoId=' + tycon1.Id);
- System.Test.setCurrentPage(page);
- TydelikeConController controller = new TydelikeConController();
- controller.init();
- controller.save();
- }
-
- static testMethod void testMethod4() {
- TydelikeAccount__c acc1 = new TydelikeAccount__c();
- acc1.name = '**';
- acc1.OwnerId = UserInfo.getUserId();
- acc1.TyCity__c = '鍖椾含';
- acc1.OfSkrap__c = false;
- acc1.TyAddress__c = '11111';
- acc1.TyPostCode__c = '123456';
- insert acc1;
-
- TydelikeContact__c tycon1 = new TydelikeContact__c();
- tycon1.name = '*';
- tycon1.OfSkrap__c = false;
- tycon1.TydelikeAccount__c = acc1.Id;
- tycon1.TyAddress__c = '11111';
- tycon1.TyFaxD__c = '1111';
- tycon1.TyPhoneD__c = '15555555555';
- tycon1.TyPostcode__c = '111111';
- insert tycon1;
- System.debug(tycon1);
-
- List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
- List<RecordType> rectBS = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
-
- Account buyer = new Account(
- Name = '*',
- FacilityName__c = 'buyer',
- PostCode__c = '123456',
- RecordTypeId = rectDealer[0].Id,
- ProductSegment__c = 'ANI'
- );
- insert buyer;
- System.debug(buyer);
-
- PageReference page = new PageReference('/apex/TydelikeCon?accName=' + buyer.Name + '&tyacId=' + acc1.Id + '&tycoId=' + tycon1.Id);
- System.Test.setCurrentPage(page);
- TydelikeConController controller = new TydelikeConController();
- controller.init();
- controller.save();
- }
-
- static testMethod void testMethod5() {
- TydelikeAccount__c acc1 = new TydelikeAccount__c();
- acc1.name = '**';
- acc1.OwnerId = UserInfo.getUserId();
- acc1.TyCity__c = '鍖椾含';
- acc1.OfSkrap__c = false;
- acc1.TyAddress__c = '11111';
- acc1.TyPostCode__c = '123456';
- insert acc1;
-
- TydelikeContact__c tycon1 = new TydelikeContact__c();
- tycon1.name = '*';
- tycon1.OfSkrap__c = false;
- tycon1.TydelikeAccount__c = acc1.Id;
- tycon1.TyAddress__c = '11111';
- tycon1.TyFaxD__c = '1111';
- tycon1.TyPhoneD__c = '15555555555';
- tycon1.TyPostcode__c = '111111';
- insert tycon1;
- System.debug(tycon1);
-
- List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
- List<RecordType> rectBS = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
-
- Account buyer = new Account(
- Name = '*',
- FacilityName__c = 'buyer',
- PostCode__c = '123456',
- RecordTypeId = rectDealer[0].Id,
- ProductSegment__c = 'RVI'
- );
- insert buyer;
- System.debug(buyer);
-
- PageReference page = new PageReference('/apex/TydelikeCon?accName=' + buyer.Name + '&tyacId=' + acc1.Id + '&tycoId=' + tycon1.Id);
- System.Test.setCurrentPage(page);
- TydelikeConController controller = new TydelikeConController();
- controller.init();
- controller.save();
- }
+
+
}
\ No newline at end of file
--
Gitblit v1.9.1