Example #1
0
        public async Task Agency_combined_bool_settings_must_apply_when_only_agency_settings_found(
            bool expectedMarkupDisabled,
            bool expectedSupplierVisible,
            bool expectedDirectContractFlagVisible)
        {
            var agentSettings  = default(Maybe <AgentAccommodationBookingSettings>);
            var agencySettings = Maybe <AgencyAccommodationBookingSettings>
                                 .From(new AgencyAccommodationBookingSettings
            {
                IsSupplierVisible           = expectedSupplierVisible,
                IsDirectContractFlagVisible = expectedDirectContractFlagVisible
            });

            var rootAgencySettings = default(RootAgencyAccommodationBookingSettings);

            var(agentSettingsService, agencySettingsService, rootAgencySystemSettingsService) = GetSettingsServices(agentSettings, agencySettings, rootAgencySettings);
            var supplierOptions = Options.Create(new SupplierOptions {
                EnabledSuppliers = new List <Suppliers> {
                    Suppliers.Unknown
                }
            });
            var flow = GetDoubleFlow();

            var service = new AccommodationBookingSettingsService(flow, agentSettingsService, agencySettingsService, rootAgencySystemSettingsService,
                                                                  supplierOptions);

            var settings = await service.Get(_agentContext);

            Assert.Equal(expectedSupplierVisible, settings.IsSupplierVisible);
            Assert.Equal(expectedDirectContractFlagVisible, settings.IsDirectContractFlagVisible);
        }
Example #2
0
        public async Task Combined_bool_settings_must_be_false_if_no_source_found()
        {
            var agentSettings      = default(Maybe <AgentAccommodationBookingSettings>);
            var agencySettings     = default(Maybe <AgencyAccommodationBookingSettings>);
            var rootAgencySettings = default(RootAgencyAccommodationBookingSettings);

            var(agentSettingsService, agencySettingsService, rootAgencySystemSettingsService) = GetSettingsServices(agentSettings, agencySettings, rootAgencySettings);
            var supplierOptions = Options.Create(new SupplierOptions {
                EnabledSuppliers = new List <Suppliers> {
                    Suppliers.Unknown
                }
            });
            var flow = GetDoubleFlow();

            var service = new AccommodationBookingSettingsService(flow, agentSettingsService, agencySettingsService, rootAgencySystemSettingsService,
                                                                  supplierOptions);

            var settings = await service.Get(_agentContext);

            Assert.False(settings.IsSupplierVisible);
            Assert.False(settings.IsDirectContractFlagVisible);
        }
        public async Task Defaults_should_apply_when_no_agent_and_agency_settings_found()
        {
            var agentSettings      = default(Maybe <AgentAccommodationBookingSettings>);
            var agencySettings     = default(Maybe <AgencyAccommodationBookingSettings>);
            var rootAgencySettings = default(RootAgencyAccommodationBookingSettings);

            var(agentSettingsService, agencySettingsService, rootAgencySystemSettingsService) = GetSettingsServices(agentSettings, agencySettings, rootAgencySettings);
            var supplierOptions = Options.Create(new SupplierOptions {
                EnabledSuppliers = new List <Suppliers> {
                    Suppliers.Unknown
                }
            });
            var flow = GetDoubleFlow();

            var service = new AccommodationBookingSettingsService(flow, agentSettingsService, agencySettingsService, rootAgencySystemSettingsService,
                                                                  supplierOptions);

            var settings = await service.Get(_agentContext);

            Assert.Equal(DefaultAprMode, settings.AprMode);
            Assert.Equal(DefaultPassedDeadlineOffersMode, settings.PassedDeadlineOffersMode);
            Assert.Equal(default, settings.AdditionalSearchFilters);