@isTest
public class TSBankContactCreate_Test2{
static testMethod void myUnitTest() {
//RecordType rt = [SELECT Id,Name FROM RecordType r WHERE r.Name='Partner Contact' LIMIT 1];
String RId='';
//Insert Bank__c record
//Bank__c bnk = new Bank__c();
//bnk.Name = 'IDBI';
// insert bnk;
//String currentId=bnk.id;
String currentId='a0770000004BDUH';
PageReference pageRef = null;
//List<Bank__c> bank = new List< Bank__c>();
for(RecordType r : [Select Id From RecordType where Name ='Partner Contact'])
{
RId=r.Id;
}
/* for (Bank__c bankfind : [Select Id from Bank__c Where Id = :currentId limit 1])
{
bank.add(bankfind);
}
*/
Contact c = new Contact(
LastName = 'Enter a valid last name',
RecordTypeId = RId,
Bank__c=currentId
// Bank__c=currentId
// Invisible_Bank__c=currentId
);
insert c;
pageRef = new PageReference('/' + c.Id+'/e?retURL=%2F'+ currentId);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : c.Id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
// System.runAs(newContact) {
// The following code runs as user 'u'
//System.debug('Current User: ' + newContact.LastName);
//System.debug('Current Profile: ' + RId);// }
}
/*
static testMethod void myUnitTest() {
//RecordType rt = [SELECT Id,Name FROM RecordType r WHERE r.Name='Partner Contact' LIMIT 1];
String RId='';
//String RId= [Select Id From RecordType where Name ='Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//String currentId=bnk.id;
PageReference pageRef = null;
List<Bank__c> bank = new List< Bank__c>();
for(RecordType r : [Select Id From RecordType where Name =: 'Partner Contact'])
{
RId=r.Id;
}
Contact c = new Contact(
LastName = 'Enter a valid last name',
RecordTypeId = RId,
Bank__c=bnk.id
// Bank__c=currentId
// Invisible_Bank__c=currentId
);
insert c;
pageRef = new PageReference('/' + c.Id+'/e?retURL=%2F'+ bnk.id);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : c.Id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
// System.runAs(newContact) {
// The following code runs as user 'u'
//System.debug('Current User: ' + newContact.LastName);
//System.debug('Current Profile: ' + RId);// }
}
static testMethod void myUnitTest1() {
PageReference pageRef = null;
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI22';
insert bnk;
//ApexPages.currentPage().getParameters().put('Id',bnk.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank__c=bnk.id,
Invisible_Bank__c=bnk.id
);
insert newContact;
System.runAs(uname)
{
Test.StartTest();
//ApexPages.StandardController sc = new ApexPages.StandardController('/' + currentId+'/e?retURL=%2F'+ bkid);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
pageRef = new PageReference('/' + newContact.id+'/e?retURL=%2F'+ bnk.id);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : newContact.id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
//TSBCon.autoRun();
Test.StopTest();
}
}
static testMethod void myUnitTest2() {
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//Insert Branch__c record
Branch__c brnch = new Branch__c();
brnch.Name = 'AP';
brnch.Bank__c=bnk.id;
insert brnch;
ApexPages.currentPage().getParameters().put('Id',brnch.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank_Branch__c=brnch.id,
Bank__c=brnch.Bank__c
);
insert newContact;
ApexPages.StandardController sc = new ApexPages.StandardController(newContact.id);
TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
System.runAs(uname) {
Test.StartTest();
TSBCon.autoRun();
Test.StopTest();
}
}
static testMethod void myUnitTest3() {
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
// TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//Insert Referral_Partner_Boarding__c record
Referral_Partner_Boarding__c Rpb = new Referral_Partner_Boarding__c();
Rpb.Name = 'RefferalName';
Rpb.Converted_Bank__c=bnk.id;
insert Rpb;
ApexPages.currentPage().getParameters().put('Id',Rpb.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank__c=Rpb.Converted_Bank__c,
Referral_Partner_Boarding__c=Rpb.id
);
insert newContact;
ApexPages.StandardController sc = new ApexPages.StandardController(newContact.id);
TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
System.runAs(uname) {
Test.StartTest();
TSBCon.autoRun();
Test.StopTest();
}
}*/
}
+++++++++++++++++++++++++++++++++++++++++
@isTest public class TSBankContactCreate_Test2{ static testMethod void myUnitTest1() { ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; ApexPages.currentPage().getParameters().put('Id',bnk.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank__c=bnk.id, Invisible_Bank__c=bnk.id ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } static testMethod void myUnitTest2() { //ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); //TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; //Insert Branch__c record Branch__c brnch = new Branch__c(); brnch.Name = 'AP'; brnch.Bank__c=bnk.id; insert brnch; ApexPages.currentPage().getParameters().put('Id',brnch.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank_Branch__c=brnch.id, Bank__c=brnch.Bank__c ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } static testMethod void myUnitTest3() { //ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); // TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; //Insert Referral_Partner_Boarding__c record Referral_Partner_Boarding__c Rpb = new Referral_Partner_Boarding__c(); Rpb.Name = 'RefferalName'; Rpb.Converted_Bank__c=bnk.id; insert Rpb; ApexPages.currentPage().getParameters().put('Id',Rpb.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank__c=Rpb.Converted_Bank__c, Referral_Partner_Boarding__c=Rpb.id ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } }
public class TSBankContactCreate_Test2{
static testMethod void myUnitTest() {
//RecordType rt = [SELECT Id,Name FROM RecordType r WHERE r.Name='Partner Contact' LIMIT 1];
String RId='';
//Insert Bank__c record
//Bank__c bnk = new Bank__c();
//bnk.Name = 'IDBI';
// insert bnk;
//String currentId=bnk.id;
String currentId='a0770000004BDUH';
PageReference pageRef = null;
//List<Bank__c> bank = new List< Bank__c>();
for(RecordType r : [Select Id From RecordType where Name ='Partner Contact'])
{
RId=r.Id;
}
/* for (Bank__c bankfind : [Select Id from Bank__c Where Id = :currentId limit 1])
{
bank.add(bankfind);
}
*/
Contact c = new Contact(
LastName = 'Enter a valid last name',
RecordTypeId = RId,
Bank__c=currentId
// Bank__c=currentId
// Invisible_Bank__c=currentId
);
insert c;
pageRef = new PageReference('/' + c.Id+'/e?retURL=%2F'+ currentId);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : c.Id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
// System.runAs(newContact) {
// The following code runs as user 'u'
//System.debug('Current User: ' + newContact.LastName);
//System.debug('Current Profile: ' + RId);// }
}
/*
static testMethod void myUnitTest() {
//RecordType rt = [SELECT Id,Name FROM RecordType r WHERE r.Name='Partner Contact' LIMIT 1];
String RId='';
//String RId= [Select Id From RecordType where Name ='Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//String currentId=bnk.id;
PageReference pageRef = null;
List<Bank__c> bank = new List< Bank__c>();
for(RecordType r : [Select Id From RecordType where Name =: 'Partner Contact'])
{
RId=r.Id;
}
Contact c = new Contact(
LastName = 'Enter a valid last name',
RecordTypeId = RId,
Bank__c=bnk.id
// Bank__c=currentId
// Invisible_Bank__c=currentId
);
insert c;
pageRef = new PageReference('/' + c.Id+'/e?retURL=%2F'+ bnk.id);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : c.Id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
// System.runAs(newContact) {
// The following code runs as user 'u'
//System.debug('Current User: ' + newContact.LastName);
//System.debug('Current Profile: ' + RId);// }
}
static testMethod void myUnitTest1() {
PageReference pageRef = null;
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI22';
insert bnk;
//ApexPages.currentPage().getParameters().put('Id',bnk.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank__c=bnk.id,
Invisible_Bank__c=bnk.id
);
insert newContact;
System.runAs(uname)
{
Test.StartTest();
//ApexPages.StandardController sc = new ApexPages.StandardController('/' + currentId+'/e?retURL=%2F'+ bkid);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
pageRef = new PageReference('/' + newContact.id+'/e?retURL=%2F'+ bnk.id);
List<Contact> accountList = [SELECT Id FROM Contact where Id = : newContact.id];
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(accountList);
// ApexPages.StandardSetController sc = new ApexPages.StandardSetController(c);
TSBankContactCreateExtention ts = new TSBankContactCreateExtention(sc);
ts.autoRun();
//TSBCon.autoRun();
Test.StopTest();
}
}
static testMethod void myUnitTest2() {
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
//TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//Insert Branch__c record
Branch__c brnch = new Branch__c();
brnch.Name = 'AP';
brnch.Bank__c=bnk.id;
insert brnch;
ApexPages.currentPage().getParameters().put('Id',brnch.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank_Branch__c=brnch.id,
Bank__c=brnch.Bank__c
);
insert newContact;
ApexPages.StandardController sc = new ApexPages.StandardController(newContact.id);
TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
System.runAs(uname) {
Test.StartTest();
TSBCon.autoRun();
Test.StopTest();
}
}
static testMethod void myUnitTest3() {
//ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate);
// TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id;
//Insert Bank__c record
Bank__c bnk = new Bank__c();
bnk.Name = 'IDBI';
insert bnk;
//Insert Referral_Partner_Boarding__c record
Referral_Partner_Boarding__c Rpb = new Referral_Partner_Boarding__c();
Rpb.Name = 'RefferalName';
Rpb.Converted_Bank__c=bnk.id;
insert Rpb;
ApexPages.currentPage().getParameters().put('Id',Rpb.id);
User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1];
Contact newContact = new Contact(
LastName = 'Test',
RecordTypeId = strRecordTypeId,
Bank__c=Rpb.Converted_Bank__c,
Referral_Partner_Boarding__c=Rpb.id
);
insert newContact;
ApexPages.StandardController sc = new ApexPages.StandardController(newContact.id);
TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc);
System.runAs(uname) {
Test.StartTest();
TSBCon.autoRun();
Test.StopTest();
}
}*/
}
+++++++++++++++++++++++++++++++++++++++++
@isTest public class TSBankContactCreate_Test2{ static testMethod void myUnitTest1() { ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; ApexPages.currentPage().getParameters().put('Id',bnk.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank__c=bnk.id, Invisible_Bank__c=bnk.id ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } static testMethod void myUnitTest2() { //ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); //TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; //Insert Branch__c record Branch__c brnch = new Branch__c(); brnch.Name = 'AP'; brnch.Bank__c=bnk.id; insert brnch; ApexPages.currentPage().getParameters().put('Id',brnch.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank_Branch__c=brnch.id, Bank__c=brnch.Bank__c ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } static testMethod void myUnitTest3() { //ApexPages.StandardController sc = new ApexPages.StandardController(/apex/TSBankContactCreate); // TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Contact' and Name = 'Partner Contact'].Id; //Insert Bank__c record Bank__c bnk = new Bank__c(); bnk.Name = 'IDBI'; insert bnk; //Insert Referral_Partner_Boarding__c record Referral_Partner_Boarding__c Rpb = new Referral_Partner_Boarding__c(); Rpb.Name = 'RefferalName'; Rpb.Converted_Bank__c=bnk.id; insert Rpb; ApexPages.currentPage().getParameters().put('Id',Rpb.id); User uname=[Select Id,Name,profile.Name from User Where profile.Name ='SYSADMIN_CAJ2' AND isActive=true limit 1]; Contact newContact = new Contact( LastName = 'Test', RecordTypeId = strRecordTypeId, Bank__c=Rpb.Converted_Bank__c, Referral_Partner_Boarding__c=Rpb.id ); insert newContact; ApexPages.StandardController sc = new ApexPages.StandardController(newContact); TSBankContactCreateExtention TSBCon = new TSBankContactCreateExtention(sc); System.runAs(uname) { Test.StartTest(); TSBCon.autoRun(); Test.StopTest(); } } }
No comments:
Post a Comment