/// <summary> /// Get booking ids for a check in date and channel booking scenario /// </summary> /// <param name="checkInDate">Check in date</param> /// <param name="channelBookingScenario">Channel booking scenario</param> /// <returns> /// The list of bookings with Id populated only /// </returns> public List<int> GetBookingIdsByCheckInDateAndChannelScenario(DateTime checkInDate, BookingScenarioTypeEnum channelBookingScenario) { const string SQL_QUERY = @"SELECT B.Id FROM Booking.Booking B INNER JOIN Booking.Orders O ON O.Id = B.OrderId INNER JOIN Distribution.Channel C ON C.Id = O.ChannelId INNER JOIN Distribution.ChannelBookingScenario CBS ON CBS.ChannelId = C.Id WHERE DATEADD(dd, 0, DATEDIFF(dd, 0, B.CheckinDatetime)) = @CheckinDate AND CBS.BookingScenarioCode = @BookingScenarioCode"; var parameters = new List<SqlParameter> { DbHelper.CreateParameter(BookingMapper.Parameters.CheckinDate, checkInDate), DbHelper.CreateParameter(BookingMapper.Parameters.BookingScenarioCode, channelBookingScenario.GetCode()) }; return DbHelper.CreateValueList<int>(SQL_QUERY, BookingMapper.Parameters.Id.ToString(), parameters: parameters); }
public void GetAgentPaymentAmountReturnsCorrectAmountsForScenariosGiven(BookingScenarioTypeEnum scenarioType, decimal totalBookingValue, decimal distributorPercentage, decimal expectedPercent) { // Arrange // done through test cases // Act SettlementManager settlementManager = new SettlementManager(); decimal result = settlementManager.GetAgentPaymentAmount(scenarioType, totalBookingValue, distributorPercentage); // Assert Assert.AreEqual(expectedPercent, result, string.Format("percentage did not match test case. scenario:{0}, ttv:{1}, percentage:{2}, expected:{3}", scenarioType.GetCode(), totalBookingValue, distributorPercentage, expectedPercent)); }