I'm trying to create a unit test where a I insert a record with a specific record type
Student_Records__c endterm = new Student_Records__c(); endterm.School__c = schl.id; endterm.Student__c = ct1.id; endterm.Position_in_class__c = 1; endterm.Type_Bursary__c = 'Full Bursary'; endterm.Type_of_Exam__c = 'Test'; endterm.Date__c = date.today(); endterm.Number_of_students_in_class__c = 10;
The above code works fine when I run the unit test but when I try add:
endterm.Recordtype.Name = 'Student Exam Records';
I get an error when I run the test. How can I set the record type of a test record being inserted?