Snippets

Tim Schuitemaker 4E4ALb: Untitled snippet

Created by Tim Schuitemaker
@IsTest
private class Test_B25_Reservation {

    @isTest private static void testDimensionJunctions() {
        B25__Reservation__c reservation = new B25__Reservation__c();
        reservation.B25__Start__c = DateTime.now();
        reservation.B25__End__c = DateTime.now().addHours(1);
        Database.insert(reservation);

        Lesson_Group_Contact__c yourobject = new Lesson_Group_Contact__c(); //replace this with the name of your object
        yourobject.Name ='a'; // if this is field is an auto number you dont need this.
        Database.insert(yourobject);

        Reservation_Lesson_Group_Contact__c resYourobject = new Reservation_Lesson_Group_Contact__c(); //replace with the name of your dimension junction object
        resYourobject.Reservation__c = reservation.Id;
        resYourobject.Lesson_Group_Contact__c = yourobject.Id; //replace this with the name of the lookup on the dimension junction
        Database.insert(resYourobject);

        System.assertEquals(1, [SELECT Id FROM B25__Reservation__c].size());
    }  
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.