public void CreateRatePlanSuccess() { // Arrange var pms = new PropertyManagementSystemService {DisableAccessRightsCheck = true}; const long BUSINESS_ID = 1; var periodDto = new PeriodDto { BusinessId = BUSINESS_ID, Name = "High", PeriodDateRanges = new List<PeriodDateRangeDto> { new PeriodDateRangeDto { StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1)} } }; PeriodDto period = pms.CreateSeason(BUSINESS_ID, periodDto, "en-GB"); var rates = new RatePlanRateDto { BusinessId = BUSINESS_ID, PeriodId = period.Id.Value, MonMinStay = 1, MonRate = new decimal(10), TueMinStay= 1, TueRate = new decimal(10), WedMinStay = 1, WedRate = new decimal(10), ThuMinStay = 1, ThuRate = new decimal(10), FriMinStay = 1, FriRate = new decimal(10), SatMinStay = 1, SatRate = new decimal(10), SunMinStay = 1, SunRate = new decimal(10), }; var ratePlanDto = new BaseRatePlanDto { BusinessId = BUSINESS_ID, RoomTypeId = 1, MaxAdults = 2, MaxChildren = 1, MaxOccupancy = 3, CancellationClass = new CancellationClassDto { Code = "FR"}, BoardBasis = new BoardBasisDto { Code = "BK" }, Rates = rates, RatePlanType = new RatePlanTypeDto { Type = RatePlanTypeEnumDto.Base}, CurrencyCode = "GBP" }; // Act BaseRatePlanDto result = pms.CreateBaseRatePlan(ratePlanDto); // Assert Assert.IsNotNull(result, "RatePlan hasn't been created"); Assert.IsNotNull(result.Rates, "Rates were not created"); Assert.IsTrue(result.Rates.Id != default(int), "Rate id was not populated"); }
public PeriodDto CreateSeason(long businessId, PeriodDto periodDto, string cultureCode) { // Make sure the current user has access to this business CheckAccessRights(businessId); if (Cache.Business.TryGetValue(businessId) == null) { throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30001, "PropertyManagementSystemService.CreateSeason", additionalDescriptionParameters: (new object[] { businessId }))); } if (businessId != periodDto.BusinessId) { throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30000, "PropertyManagementSystemService.CreateSeason", additionalDescriptionParameters: (new object[] { businessId, periodDto.BusinessId }), arguments: new object[] { businessId, periodDto })); } periodDto.PeriodTypeEnum = PeriodTypeEnumDto.Season; Period period = Mapper.Map<PeriodDto, Period>(periodDto); return Mapper.Map<Period, PeriodDto>(periodManager.CreatePeriod(period, cultureCode)); }