I have an apex test class that is not working due to not having an appointment tied to it. I'm not sure how I've messed up. I know this is a beyond easy fix but I've been looking at it for too long and I'd like an outside perspective.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot add a sale with a missing appointment: [i360__Appointment__c]
Here is the apex test class.
@isTest
private class HomeDepotStoreTest {
static testMethod void TestHomeDepotStores()
{
i360__Staff__c staff = new i360__Staff__c();
staff.Name = '2036';
insert staff;
i360__Prospect__c Pros = new i360__Prospect__c();
Pros.Name ='Bob Joe';
Pros.Referral_Store__c = '2036';
Pros.i360__Phone_1__c = '(123) 123-1234';
Pros.i360__Primary_Last_Name__c = 'TESTMCTEST';
insert Pros;
i360__Appointment__c App = new i360__Appointment__c();
App.Name = '2036';
App.i360__Prospect__c = Pros.Id;
i360__Sale__c a = new i360__Sale__c();
a.Name ='2036';
a.i360__Appointment__c = App.Id;
insert a;
}
}