protected override void RunBeforeAllTests() { base.RunBeforeAllTests(); var businessManager = new BusinessManager(); var roomTypeManager = new RoomTypeManager(); var roomManager = new RoomManager(); var orderManager = new OrderManager(); //Create a business var paymentMethod = new BusinessPaymentMethod { BusinessId = BUSINESS_ID, CurrencyCode = CURRENCY, PaymentMethodCode = PaymentMethodEnum.Cash.GetCode() }; var provider = new Provider { RoomCount = ROOM_COUNT, ContentId = BUSINESS_ID.ToString(), ProviderTypeCode = PROVIDER_TYPE, }; var business = new Model.Business.Business { BusinessStatusCode = "A", BusinessTypeCode = "P", Name = "Test Business", ShortName = "Test", ReferenceCode = "B001", IsTaxRegistered = true, TaxRegistrationNumber = "12345", BusinessRegistrationNumber = "12345", AddressLine1 = "5 Main Road", AddressLine2 = "Twickenham", City = "London", StateProvinceId = 386, PostCode = "TW2 5SE", CountryId = 16, BusinessTelephoneNumber = "07448752114", TimeZoneId = 36, DefaultCultureCode = CULTURE, WorkingCurrencyCode = CURRENCY, UpdatedByUserId = new Guid("11111111-1111-1111-1111-111111111111"), Provider = provider, BusinessPaymentMethods = new List<BusinessPaymentMethod> {paymentMethod} }; var businessId = businessManager.CreateBusiness(business); // Create a room type var ratePlan = new BaseRatePlan { BusinessId = businessId, CurrencyCode = CURRENCY, MaxAdults = 2, MaxChildren = 2, MaxOccupancy = 3, BoardBasis = new EnumEntity {Code = "BK"}, CancellationClass = new EnumEntity {Code = "FR"}, RackRate = new decimal(120.0), SellAtRackRate = true, RatePlanType = new RatePlanType {Type = RatePlanTypeEnum.Base}, Rates = new RatePlanRate{BusinessId = businessId, MonRate = 120, MonMinStay = 120}, UpdatedByUserId = new Guid("11111111-1111-1111-1111-111111111111"), }; var roomType = new RoomType { BusinessId = businessId, RoomClass = roomTypeManager.GetRoomClasses(CULTURE).FirstOrDefault(), //new RoomClass { Code = "DBL" }, QualityType = roomTypeManager.GetQualityTypes(CULTURE).FirstOrDefault(), //new QualityType { Code = "APT" }, BathroomType = roomTypeManager.GetBathroomTypes(CULTURE).FirstOrDefault(), //new BathroomType { Code = "SP" }, Code = "DBL99", ServiceFrequency = new EnumEntity { Code = "B" }, UpdatedByUserId = new Guid("11111111-1111-1111-1111-111111111111"), BaseRatePlan = ratePlan, BaseRatePlanId = ratePlan.Id, Aspect = new Aspect { Code = "BAL"}, }; roomTypeManager.CreateRoomTypeAndBaseRatePlan(roomType); roomType = roomTypeManager.GetRoomTypesAndBaseRatePlans(businessId, CULTURE).First(); ratePlan = roomType.BaseRatePlan; //Create a room var roomId = roomManager.CreateRoom("TestRoom", roomType.Id, businessId); //Create an order var booking = new Booking { BusinessId = businessId, Guest = new Guest { DefaultCultureCode = CULTURE, Surname = "TestSurname", BusinessId = businessId }, StartDate = new DateTime(2014, 2, 10, 0, 0, 0, DateTimeKind.Utc), EndDate = new DateTime(2014, 2, 12, 0, 0, 0, DateTimeKind.Utc), NumberOfAdults = 2, NumberOfChildren = 1, Cost = new decimal(120.5), BookingStatus = new EnumEntity { Code = BookingStatusType.CONFIRMED }, RoomTypeId = roomType.Id, RoomId = roomId, RatePlanId = ratePlan.Id, Notes = "Testing note", BookingScenarioType = BookingScenarioTypeEnum.OnAccountBooking, RateType = new EnumEntity { Code = RateType.BEST_AVAILABLE_RATE }, CheckinStatus = new EnumEntity { Code = CheckinStatusOptions.NOTCHECKEDIN }, IsAvailabilityIgnored = true, BoardBasis = BoardBasisTypeEnum.BreakfastIncluded, CancellationDetails = new CancellationDetail() }; var order = new Order { OfflineSourceEnum = OfflineSourceEnum.Web, OrderSourceCode = SourceType.Pms.GetCode(), CustomerCurrencyCode = CURRENCY, Bookings = new List<Booking> { booking }, CustomerCultureCode = "en-GB" }; // Mock email manager so it doesn't send emails var emailManager = new Mock<IEmailManager>(); orderManager.EmailManager = emailManager.Object; emailManager.Setup(x => x.SendConfirmationEmails(order)).Returns(true); orderManager.CreateOrder(businessId, order); }
public void GetRoomClassesIsSuccessful() { // Arrange const string CULTURE_CODE = "en-GB"; var roomTypeDao = MockRepository.GenerateMock<IRoomTypeDao>(); var roomTypeManager = new RoomTypeManager { RoomTypeDao = roomTypeDao }; roomTypeDao.Expect(x => x.GetRoomClasses(CULTURE_CODE)).Return(new List<RoomClass>()); // Act roomTypeManager.GetRoomClasses(CULTURE_CODE); // Assert roomTypeDao.VerifyAllExpectations(); }