public void CreateBookingChargeCallsCorrectMethod()
            {
                // Arrange
                const int BUSINESS_ID = 1;

                var bookingItemDto = new BookingItemDto
                    {
                        Id = 1,
                        ItemType = ItemTypeEnumDto.Charge
                    };

                var bookingItemManagerMock = MockRepository.GenerateMock<IBookingItemManager>();
                PropertyManagementSystemService.BookingItemManager = bookingItemManagerMock;
                PropertyManagementSystemService.FakeAuthenticationForDebugging = true;
                
                bookingItemManagerMock.Expect(b => b.CreateBookingCharge(Arg<BookingItem>.Is.Anything)).Repeat.Once();

                // Act
                PropertyManagementSystemService.CreateBookingCharge(BUSINESS_ID, bookingItemDto);

                // Assert
                bookingItemManagerMock.VerifyAllExpectations();
            }
 public BookingItemDto CreateBookingCharge(long businessId, BookingItemDto bookingItemDto)
 {
     CheckAccessRights(businessId);
     
     return GetBookingCharge(businessId, bookingItemDto);
 }
        /// <summary>
        /// Create a BookingItem for a charge or discount
        /// </summary>
        /// <param name="businessId">The id of the business</param>
        /// <param name="bookingItemDto">The booking item to create</param>
        /// <returns>The updated booking item with booking item id</returns>
        private BookingItemDto GetBookingCharge(long businessId, BookingItemDto bookingItemDto)
        {
            CheckAccessRights(businessId);

            var bookingItem = DataTransferObjectsConverter.ConvertBookingItemDtoToBookingItem(bookingItemDto);

            bookingItemManager.CreateBookingCharge(bookingItem);
            bookingItemDto.Id = bookingItem.Id;

            return bookingItemDto;
        }
 /// <summary>
 ///  Convert BookingItem dto to BookingItem object
 /// </summary>
 /// <param name="bookingItemDto">BookingItem dto</param>
 /// <returns>BookingItem object</returns>
 public static BookingItem ConvertBookingItemDtoToBookingItem(BookingItemDto bookingItemDto)
 {
     return new BookingItem
     {
         Id = bookingItemDto.Id,
         BookingId = bookingItemDto.BookingId,
         ItemType = (ItemTypeEnum)bookingItemDto.ItemType,
         ItemDescription = bookingItemDto.ItemDescription,
         ItemStatus = (ItemStatusEnum)bookingItemDto.ItemStatus,
         Quantity = bookingItemDto.Quantity,
         EventDate = bookingItemDto.EventDate,
         RatePlanId = bookingItemDto.RatePlanId,
         Charge = Mapper.Map<Charge>(bookingItemDto.Charge),
         ApplicationPaymentId = bookingItemDto.ApplicationPaymentId,
         IsOverBooking = bookingItemDto.IsOverBooking,
         UpdatedByUserId = bookingItemDto.UpdatedByUserId
     };
 }