public void Test_SettingsProvider_Should_LoadSettings() { var executionContext = new FakeExecutionContext(new FakeDataService(), new DefaultCache()); var factory = new SettingsProviderFactory(new FakeSettingConnector()); var settings = factory.CreateSettingsProvider(executionContext); Assert.AreEqual(3, settings.Count); Assert.AreEqual("VALUE1", settings.GetValue <string>("ENV1")); Assert.AreEqual("VALUE1", settings.GetValue <string>("env1")); Assert.AreEqual(TimeSpan.FromSeconds(0).Ticks, settings.GetValue <TimeSpan?>("CCLLC.SettingsCacheTimeOut").Value.Ticks); }
/// <summary> /// By default, we are configured to use MEF /// </summary> protected override void Configure() { try { var splashScreen = new SplashScreen(Assembly.GetAssembly(typeof(AppBootstrapper)), "daxstudio-splash.png"); splashScreen.Show(true); // Tell Caliburn Micro how to find controls in Fluent Ribbon /* * defaultElementLookup = BindingScope.GetNamedElements; * BindingScope.GetNamedElements = new Func<System.Windows.DependencyObject, IEnumerable<System.Windows.FrameworkElement>>( * k => * { * List<FrameworkElement> namedElements = new List<FrameworkElement>(); * namedElements.AddRange(defaultElementLookup(k)); * Fluent.Ribbon ribbon = LookForRibbon(k); * if (null != ribbon) * AppendRibbonNamedItem(ribbon, namedElements); * return namedElements; * } * ); */ ConventionManager.AddElementConvention <Fluent.Spinner>(Fluent.Spinner.ValueProperty, "Value", "ValueChanged"); // TODO - do I need to replace these conventions ?? //ConventionManager.AddElementConvention<NumericUpDownLib.DoubleUpDown>(NumericUpDownLib.DoubleUpDown.ValueProperty, "Value", "ValueChanged"); //ConventionManager.AddElementConvention<Xceed.Wpf.Toolkit.DoubleUpDown>(Xceed.Wpf.Toolkit.DoubleUpDown.ValueProperty, "Value", "ValueChanged"); //ConventionManager.AddElementConvention<Xceed.Wpf.Toolkit.IntegerUpDown>(Xceed.Wpf.Toolkit.IntegerUpDown.ValueProperty, "Value", "ValueChanged"); //ConventionManager.AddElementConvention<Xceed.Wpf.Toolkit.WatermarkTextBox>(Xceed.Wpf.Toolkit.WatermarkTextBox.TextProperty, "Text", "TextChanged"); // Add Fluent Ribbon resovler BindingScope.AddChildResolver <Fluent.Ribbon>(FluentRibbonChildResolver); // Fixes the default datetime format in the results listview // from: http://stackoverflow.com/questions/1993046/datetime-region-specific-formatting-in-wpf-listview FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); var catalog = new AggregateCatalog( AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType <ComposablePartCatalog>() ); //_container = new CompositionContainer(catalog,true); _container = new CompositionContainer(catalog); var batch = new CompositionBatch(); batch.AddExportedValue <IWindowManager>(new WindowManager()); batch.AddExportedValue <IEventAggregator>(new EventAggregator()); batch.AddExportedValue <Func <DocumentViewModel> >(() => _container.GetExportedValue <DocumentViewModel>()); batch.AddExportedValue <Func <IWindowManager, IEventAggregator, DocumentViewModel> >( (w, e) => _container.GetExportedValue <DocumentViewModel>()); batch.AddExportedValue(_container); batch.AddExportedValue(catalog); ISettingProvider settingProvider = SettingsProviderFactory.GetSettingProvider(); batch.AddExportedValue <ISettingProvider>(settingProvider); _container.Compose(batch); // Add AvalonDock binding convetions AvalonDockConventions.Install(); //var settingFactory = _container.GetExport<Func<ISettingProvider>>(); ConfigureKeyBindingConvention(); // TODO - not working //VisibilityBindingConvention.Install(); // Enable Caliburn.Micro debug logging //LogManager.GetLog = type => new DebugLogger(type); // Add Application object to MEF catalog _container.ComposeExportedValue <Application>("System.Windows.Application", Application.Current); } catch (Exception e) { Debug.WriteLine(e); } }