Untitled
unknown
plain_text
2 years ago
3.1 kB
5
Indexable
Test.startTest();
User newtestuser = TestDataUtility.createUser('System Administrator', 'NewTest_User@testemail.com');
insert newtestuser;
User newtestuser2 = TestDataUtility.createUser('System Administrator', 'NewTest_User@testemail.com');
insert newtestuser2;
Employee__c mentorEmployee = new Employee__c();
Employee__c menteeEmployee = new Employee__c();
Certification__c newcerti= new Certification__c();
Certification__c newcerti1= new Certification__c();
System.runAs(newtestuser) {
mentorEmployee = TestDataUtility.createEmployee('02');
mentorEmployee.EE__c = '02';
// mentorEmployee.Date_Of_Joining__c = Date.newInstance(currentYear, 1, 1);
mentorEmployee.Date_Of_Joining__c = Date.newInstance(System.now().Year()-1, 1, 1);
mentorEmployee.ownerId = newtestuser.Id;
mentorEmployee.Active__c = TRUE;
insert mentorEmployee;
menteeEmployee = TestDataUtility.createEmployee('03');
menteeEmployee.EE__c = '03';
// mentorEmployee.Date_Of_Joining__c = Date.newInstance(currentYear, 1, 1);
menteeEmployee.Date_Of_Joining__c = Date.newInstance(System.now().Year()-1, 1, 1);
menteeEmployee.ownerId = newtestuser2.Id;
menteeEmployee.Active__c = TRUE;
menteeEmployee.Mentor__c = newtestuser.Id;
menteeEmployee.Mentor_Employee__c= mentorEmployee.Id;
insert menteeEmployee;
Certification_Inventory__c ci= new Certification_Inventory__c();
ci.Name='Maintenance Certification';
ci.CertificateAmount__c=100;
ci.recordTypeId= Schema.SObjectType.Certification_Inventory__c.getRecordTypeInfosByName().get('Salesforce Certification').getRecordTypeId();
insert ci;
Certification_Inventory__c ci1= new Certification_Inventory__c();
ci1.Name='App Builder';
ci1.CertificateAmount__c=100;
ci1.recordTypeId= Schema.SObjectType.Certification_Inventory__c.getRecordTypeInfosByName().get('Salesforce Certification').getRecordTypeId();
insert ci1;
newcerti.CertificateName__c=ci.id;
newcerti.status__c='Awaiting Mentor Approval';
newcerti.Employee_Name__c=menteeEmployee.id;
newcerti.recordTypeId= Schema.SObjectType.Certification__c.getRecordTypeInfosByName().get(Label.newSalesforceRecordType).getRecordTypeId();
insert newcerti;
//newcerti.Result__c='Pass';
//update newcerti;
newcerti1.CertificateName__c=ci.id;
newcerti1.status__c='Initiated';
newcerti1.Employee_Name__c=menteeEmployee.id;
newcerti1.Certification_Domain__c ='Salesforce';
newcerti1.recordTypeId= Schema.SObjectType.Certification__c.getRecordTypeInfosByName().get(Label.newSalesforceRecordType).getRecordTypeId();
insert newcerti1;Editor is loading...
Leave a Comment