예제 #1
0
        public void SetupDependencies()
        {
            var configurationManager = new ConfigurationManagerAdapter();
            var configuration        = new AppConfiguration(configurationManager);

            SqlQueryExecutor = new SqlQueryExecutor(configuration);
        }
예제 #2
0
파일: Framework.cs 프로젝트: LazyTarget/Lux
        static Framework()
        {
            //CultureInfo = CultureInfo.CurrentCulture;
            CultureInfo = null;

            ConfigurationManager = new ConfigurationManagerAdapter();
            //ConfigurationManager = new LuxConfigurationManager(new ConfigurationManagerAdapter());

            ConfigManager = new XmlConfigManager();
            TypeInstantiator = new TypeInstantiator();
            Asserter = new EmptyAsserter();
            LogFactory = new NullObjectLogFactory();

#if DEBUG
            LogFactory = new DebugLogFactory();
#endif
        }
        public void CreateConfigSettings_WithCategorySections_PreservesGlobalSettingsForSites(bool useCategorySections)
        {
            var globalSetting = new CmsSetting("Key1", "Value1", "Category1", null);
            var siteSetting   = new CmsSetting("Key2", "Value2", "Category1", "Site");

            ReadOnlyCollection <CmsSetting> settings = new List <CmsSetting>
            {
                globalSetting,
                siteSetting
            }
            .AsReadOnly();

            IQueryHandler <AllConfigCmsSettingsQuery, IReadOnlyCollection <CmsSetting> > allSettingsQueryHandler = A.Fake <IQueryHandler <AllConfigCmsSettingsQuery, IReadOnlyCollection <CmsSetting> > >();

            A.CallTo(() => allSettingsQueryHandler.Handle(A <AllConfigCmsSettingsQuery> .Ignored))
            .Returns(settings);

            var configurationManager = new ConfigurationManagerAdapter();
            var configuration        = new AppConfiguration(configurationManager);
            var options = new CmsSettingsConfigBuilderOptions
            {
                UseCategorySections = useCategorySections
            };
            var configKeyNameFactory = new CmsSettingConfigKeyNameFactory(configuration, options);

            var sut = new CmsSettingsConfigBuilderInternal(
                options,
                allSettingsQueryHandler,
                configKeyNameFactory
                );

            ICollection <KeyValuePair <string, string> > values = sut.GetAllValues(null);

            // If a category has at least one Site setting value, all other keys in that category should be made available within the corresponding Site "section" by falling back to Global settings values where a Site specific value is not available

            string globalSettingKey = configKeyNameFactory.CreateConfigKeyName(globalSetting);
            string expected         = globalSetting.Value;

            KeyValuePair <string, string> configSetting = values.FirstOrDefault(setting => setting.Key == globalSettingKey);
            string actual = configSetting.Value;

            Assert.That(actual, Is.EqualTo(expected));
        }
        protected override void LazyInitialize(string name, NameValueCollection config)
        {
            base.LazyInitialize(name, config);

            ProcName = config[ProcNameTag];

            bool.TryParse(config[UseCategorySectionsTag] ?? "false", out bool useCategorySections);
            UseCategorySections = useCategorySections;

            string keyPrefix = config[prefixTag] ?? string.Empty;

            bool.TryParse(config[stripPrefixTag] ?? "false", out bool stripPrefix);

            // This class serves as an adapter for the actual config builder impl
            // Config builders are based on the provider model and so we can't inject dependencies
            // So we will compose our implementation and its dependencies here

            var options = new CmsSettingsConfigBuilderOptions
            {
                ProcName            = ProcName,
                UseCategorySections = UseCategorySections,
                KeyPrefix           = keyPrefix,
                StripPrefix         = stripPrefix,
                Optional            = Optional
            };

            var configurationManager    = new ConfigurationManagerAdapter();
            var configuration           = new AppConfiguration(configurationManager);
            var sqlQueryExecutor        = new SqlQueryExecutor(configuration);
            var allSettingsQueryHandler = new AllConfigCmsSettingsQueryHandler(sqlQueryExecutor);

            var configKeyNameFactory = new CmsSettingConfigKeyNameFactory(configuration, options);

            ConfigBuilder = new CmsSettingsConfigBuilderInternal(
                options,
                allSettingsQueryHandler,
                configKeyNameFactory
                );
        }
 public void TestSetUp()
 {
     _target = new ConfigurationManagerAdapter();
 }
예제 #6
0
        public void SetupDependencies()
        {
            var configurationManager = new ConfigurationManagerAdapter();

            Configuration = new AppConfiguration(configurationManager);
        }
 public void TestSetUp()
 {
     _target = new ConfigurationManagerAdapter();
 }
예제 #8
0
 public Application(IConfiguration configuration)
 {
     Manager   = new ConfigurationManagerAdapter(configuration);
     Kernel    = new DefaultKernel(new DefaultDependencyResolver(), new DefaultProxyFactory());
     Container = new WindsorContainer(Kernel, new DefaultComponentInstaller());
 }