@isTest
|
private 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;
|
|
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();
|
}
|
|
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();
|
}
|
}
|