protected void RegisterTestBooking(ExpectedBooking booking, SetupData setup)
        {
            var json     = CreateBookingSaveCommandJson(booking);
            var response = PostBooking(json, setup);

            if (response.Payload != null)
            {
                booking.Id = ((SingleSessionBookingData)response.Payload).id;
            }
        }
        protected void RegisterBarneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days(SetupData setup)
        {
            if (setup.BarneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days != null)
            {
                return;
            }

            RegisterCourseAaronOrakeiHolidayCamp9To15For3Days(setup);
            RegisterCustomerBarney(setup);

            var barneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = new ExpectedBooking(setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[2].Id,
                                                                                                     setup.Barney.Id);

            RegisterTestBooking(barneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days, setup);
            setup.BarneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = barneyOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days;
        }
        protected void RegisterFredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days(SetupData setup, int studentCapacity = 3)
        {
            if (setup.FredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days != null)
            {
                return;
            }

            RegisterCourseAaronOrakeiHolidayCamp9To15For3Days(setup, studentCapacity);
            RegisterCustomerFred(setup);

            var fredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = new ExpectedBooking(setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[1].Id,
                                                                                                     setup.Fred.Id);

            RegisterTestBooking(fredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days, setup);
            setup.FredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = fredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days;
        }
        protected void RegisterFredOnAllCourseSessionsInAaronOrakeiHolidayCamp9To15For3Days(SetupData setup)
        {
            if (setup.FredOnAaronOrakeiHolidayCamp9To15For3Days != null)
            {
                return;
            }

            RegisterCourseAaronOrakeiHolidayCamp9To15For3Days(setup);
            RegisterCustomerFred(setup);

            var courseSessionIds = new List <Guid>
            {
                setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[0].Id,
                setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[1].Id,
                setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[2].Id
            };

            var fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = new ExpectedCourseBooking(courseSessionIds,
                                                                                                        setup.Fred.Id);

            RegisterTestBooking(fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days, setup);
            setup.FredOnAaronOrakeiHolidayCamp9To15For3Days = fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days;

            var sessionBookingOne = new ExpectedBooking(setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[0].Id, setup.Fred.Id)
            {
                Id = fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days.SessionBookingIds[0]
            };
            var sessionBookingTwo = new ExpectedBooking(setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[1].Id, setup.Fred.Id)
            {
                Id = fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days.SessionBookingIds[1]
            };
            var sessionBookingThree = new ExpectedBooking(setup.AaronOrakeiHolidayCamp9To15For3Days.Sessions[2].Id, setup.Fred.Id)
            {
                Id = fredOnAllCourseSessionInAaronOrakeiHolidayCamp9To15For3Days.SessionBookingIds[2]
            };

            setup.FredOnFirstCourseSessionInAaronOrakeiHolidayCamp9To15For3Days  = sessionBookingOne;
            setup.FredOnSecondCourseSessionInAaronOrakeiHolidayCamp9To15For3Days = sessionBookingTwo;
            setup.FredOnLastCourseSessionInAaronOrakeiHolidayCamp9To15For3Days   = sessionBookingThree;
        }
 private string CreateBookingSaveCommandJson(ExpectedBooking booking)
 {
     return(JsonSerialiser.Serialise(CreateBookingSaveCommand(booking)));
 }
 protected ApiBookingSaveCommand CreateBookingSaveCommand(ExpectedBooking booking)
 {
     return(new ApiBookingSaveCommand(booking.Session.id.Value, booking.Customer.id.Value));
 }