You need to sign in to do that
Don't have an account?
harsha vardhan vasa 9
need a class for test class written pls help guys :
Hi guys ,
need to write a class for the test class attached. please help me asap:
@istest
static void insertTest01() {
//契約
ContractSheet__c contract = new ContractSheet__c();
contract.Name = 'Contract1';
insert contract;
//企業
Account acc1 = new Account();
acc1.Name = 'Acc1';
Account acc2 = new Account();
acc2.Name = 'Acc2';
insert new List<Account>{acc1, acc2};
//契約締結先
AccountContract__c accCon1 = new AccountContract__c();
accCon1.Contract__c = contract.Id;
accCon1.Account__c = acc1.Id;
AccountContract__c accCon2 = new AccountContract__c();
accCon2.Contract__c = contract.Id;
accCon2.Account__c = acc2.Id;
Test.startTest();
insert new List<AccountContract__c>{accCon1, accCon2};
Test.stopTest();
contract = [SELECT ContractPartner__c FROM ContractSheet__c WHERE Id =: contract.Id];
system.assertEquals(acc1.Name + ', ' + acc2.Name, contract.ContractPartner__c);
}
Regards,
Vasa Harsha Vardhan.
need to write a class for the test class attached. please help me asap:
@istest
static void insertTest01() {
//契約
ContractSheet__c contract = new ContractSheet__c();
contract.Name = 'Contract1';
insert contract;
//企業
Account acc1 = new Account();
acc1.Name = 'Acc1';
Account acc2 = new Account();
acc2.Name = 'Acc2';
insert new List<Account>{acc1, acc2};
//契約締結先
AccountContract__c accCon1 = new AccountContract__c();
accCon1.Contract__c = contract.Id;
accCon1.Account__c = acc1.Id;
AccountContract__c accCon2 = new AccountContract__c();
accCon2.Contract__c = contract.Id;
accCon2.Account__c = acc2.Id;
Test.startTest();
insert new List<AccountContract__c>{accCon1, accCon2};
Test.stopTest();
contract = [SELECT ContractPartner__c FROM ContractSheet__c WHERE Id =: contract.Id];
system.assertEquals(acc1.Name + ', ' + acc2.Name, contract.ContractPartner__c);
}
Regards,
Vasa Harsha Vardhan.
Can you explain what you are trying to do
thaks for the time. i know the process but in my project we have to do this. no other way.
Requirement: 3 objects - Account(parent),contractsheet(child),accountcontract(connected obj)
******
Get the company Name(field Name)of the company from (Account__c) that is linked to the contract(ContractSheet__c)via the contract execution destination(AccountContract__c), and update the account name to the field(ContractPartner__c)of the contract record.
- if there are multiple names linked to the contractsheet__c those names should be concatenated by comma symbol
Regards,
Vasa Harsha Vardhan.