/// <summary> /// Given certain conditions. /// </summary> protected override void Given() { titleProvider.Setup(a => a.Title).Returns("Test"); descriptionProvider.Setup(a => a.Description).Returns("Description"); classUnderTest = new SettingsProvider(titleProvider.Object, descriptionProvider.Object); }
public SchedulerModel() { ControlDropCommand = new DropCommand(Command_OnDrop); SettingsProvider provider = new SettingsProvider(); provider.SettingsLoaded += OnSettingsLoaded; provider.RequestSettings(""); }
public void SetUp() { var resolver = ObjectResolver.Basic(); theSource = new FolderAppSettingsXmlSource("Configuration"); theProvider = new SettingsProvider(resolver, new ISettingsSource[]{theSource}); }
public override void Configure(Container container) { JsConfig.EmitCamelCaseNames = true; Plugins.Add(new SwaggerFeature()); var manager = new InsteonManager(insteonSource); container.Register(manager); var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon")); var mySettings = settingsProvider.GetSettings<SmartThingsSettings>(); container.Register(mySettings); manager.Network.Devices.DeviceStatusChanged += (sender, data) => { logger.DebugFormat("{0}:{1}", data.Device.Address, data.DeviceStatus); var settings = container.Resolve<SmartThingsSettings>(); var cb = new SmartThingsCallbacks(settings); cb.PushDeviceStatusUpdate(data.Device, data.DeviceStatus); }; GlobalResponseFilters.Add((req, res, dto) => { res.AddHeader("X-Insteon", ServiceName); }); manager.Connect(); }
private static void RegisterEverything() { var settingsProvider = new SettingsProvider(Environment.CurrentDirectory + SettingsPath); ServiceLocator.AddService<SettingsProvider>(settingsProvider); var drawer = new ConsolePrinter(); ServiceLocator.AddService<IDrawer>(drawer); }
public void Configure(IAppHost appHost) { var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox")); var mySettings = settingsProvider.GetSettings<SmartThingsSettings>(); var container = appHost.GetContainer(); container.Register(mySettings); container.RegisterAs<SmartThingsCallbacks, IParadoxEventCallbacks>(); }
public object GetKey(string key) { IEnumerable<ISettingsSource> sources = new[]{new SettingsSource(new []{Data})}; var sp = new SettingsProvider(null, sources); var result = sp.SettingFor(key); return result; }
public void Configure(IAppHost appHost) { var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox")); var mySettings = settingsProvider.GetSettings<ParadoxMqttSettings>(); var container = appHost.GetContainer(); container.Register(mySettings); container.Register(new MqttClient(mySettings.BrokerUrl)); container.RegisterAs<MqttCallbacks, IParadoxEventCallbacks>().ReusedWithin(ReuseScope.Container); }
public void CalledApplicationEntity_ReturnsExpectedValue() { // Arrange SettingsProvider settingsProvider = new SettingsProvider(); // Act var result = settingsProvider.CalledApplicationEntity; // Assert Assert.That(result, Is.EqualTo("ORTHANC")); }
public void DestinationApplicationEntity_ReturnsExpectedValue() { // Arrange SettingsProvider settingsProvider = new SettingsProvider(); // Act var result = settingsProvider.DestinationApplicationEntity; // Assert Assert.That(result, Is.EqualTo("TAUCO")); }
public void RemoteAddress_ReturnsExpectedValue() { // Arrange SettingsProvider settingsProvider = new SettingsProvider(); // Act var result = settingsProvider.RemoteAddress; // Assert Assert.That(result, Is.EqualTo("127.0.0.1")); }
public void LocalPort_ReturnsExpectedValue() { // Arrange SettingsProvider settingsProvider = new SettingsProvider(); // Act var result = settingsProvider.LocalPort; // Assert Assert.That(result, Is.EqualTo(104)); }
public void MethodArgumentsTest() { var provider = new SettingsProvider(); var settings = new TestSettings() { Test = "Test1" }; AssertHelper.ExpectedException<ArgumentNullException>(() => provider.SaveSettings(testSettingsPath, null)); AssertHelper.ExpectedException<ArgumentException>(() => provider.SaveSettings(null, settings)); AssertHelper.ExpectedException<ArgumentException>(() => provider.SaveSettings("MockSettings.xml", settings)); AssertHelper.ExpectedException<ArgumentException>(() => provider.LoadSettings<TestSettings>(null)); AssertHelper.ExpectedException<ArgumentException>(() => provider.LoadSettings<TestSettings>("MockSettings.xml")); }
public ResponseStatus Get(SmartThingsSettingsResetRequest request) { settings.AccessToken = null; settings.Location = null; settings.ApplicationId = null; var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox")); settingsProvider.SaveSettings(settings); var cb = new SmartThingsCallbacks(settings); return !cb.AuthorizationRevoke() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //Use RoamingAppDataStorage if you have the package version of SettingsProvider.net package settingsProvider = new SettingsProvider(new LocalAppDataStorage("WindowsIncognito")); appSettings = settingsProvider.GetSettings<IncognitoSettings>(); MainWindow mw = new MainWindow(); softwareRepository = new SoftwareRepository(); var viewModel = new MainWindowViewModel(appSettings, softwareRepository); mw.DataContext = viewModel; mw.Show(); }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Ensure the current culture passed into bindings // is the OS culture. By default, WPF uses en-US // as the culture, regardless of the system settings. LocalizationManager.GlobalStringLoader = new TelerikStringLoader(); Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentUICulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture; var radDiagnostics = new RadDiagnostics(); radDiagnostics.EmailTo = "*****@*****.**"; radDiagnostics.IncludeScreenshot = true; radDiagnostics.Init(); (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color = Color.FromArgb(0xFF, 0xD2, 0xDA, 0x86); _settingsProvider = new SettingsProvider(); // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Current.Host.Settings.EnableFrameRateCounter = false; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Disable the application idle detection by setting the UserIdleDetectionMode property of the // application's PhoneApplicationService object to Disabled. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } TimeDataInterface.CheckDatabase(); ReturnVisitsInterface.CheckDatabase(); RvPreviousVisitsDataInterface.CheckDatabase(); RBCTimeDataInterface.CheckDatabase(); TerritoryCardsInterface.CheckDatabase(); StreetBuildingInterface.CheckDatabase(); House2HouseRecordsInterface.CheckDatabase(); }
public ResponseStatus Put(SmartThingsSettingsRequest request) { // always reset values settings.AccessToken = request.AccessToken; settings.Location = request.Location; settings.ApplicationId = request.AppId; var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox")); settingsProvider.SaveSettings(settings); var cb = new SmartThingsCallbacks(settings); return !cb.Authorization() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus(); }
/// <summary> /// Merge any settings provided by a test service with the parameters /// that were passed inside the TestHarnessSettings. /// </summary> /// <param name="testService">The test service.</param> /// <param name="inputSettings">The run settings.</param> private static void MergeSettingsAndParameters(TestServiceProvider testService, UnitTestSettings inputSettings) { if (testService != null && testService.HasService(TestServiceFeature.RunSettings)) { SettingsProvider settings = testService.GetService <SettingsProvider>(TestServiceFeature.RunSettings); foreach (string key in settings.Settings.Keys) { if (inputSettings.Parameters.ContainsKey(key)) { Debug.WriteLine("MergeSettingsAndParameters: Overwriting " + key + " key during merge."); } inputSettings.Parameters[key] = settings.Settings[key]; } } }
internal static SettingsProvider CreateSettingsProvider() { var settingsProvider = new SettingsProvider("Preferences/2D/Tile Palette", SettingsScope.User, SettingsProvider.GetSearchKeywordsFromGUIContentProperties <GridPaintPaletteWindowPreferences>()) { guiHandler = searchContext => { GridPaintPaletteWindow.PreferencesGUI(); GridPaintActiveTargetsPreferences.PreferencesGUI(); SceneViewOpenTilePaletteHelper.PreferencesGUI(); TilemapPrefabStageHelper.PreferencesGUI(); } }; return(settingsProvider); }
public UnrealTournamentModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer, MetroDialogService dialogService) : base(deviceManager, luaManager) { _pipeServer = pipeServer; _dialogService = dialogService; Settings = SettingsProvider.Load <UnrealTournamentSettings>(); DataModel = new UnrealTournamentDataModel(); ProcessNames.Add("UE4-Win64-Shipping"); _killTimer = new Timer(3500); _killTimer.Elapsed += KillTimerOnElapsed; FindGame(); }
public static SettingsProvider CreateMyCustomSettingsProvider() { var provider = new SettingsProvider(ACTkEditorConstants.SettingsProviderPath, SettingsScope.Project) { label = "Anti-Cheat Toolkit", guiHandler = searchContext => { SettingsGUI.OnGUI(); }, keywords = new HashSet <string>(new[] { "focus", "codestage", "Anti", "Cheat", "Toolkit", "Injection", "Hash", "Wall", "Hack", "ACTk" }) }; return(provider); }
public ResponseStatus Put(SmartThingsSettingsRequest request) { // always reset values settings.AccessToken = request.AccessToken; settings.Location = request.Location; settings.ApplicationId = request.AppId; var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox")); settingsProvider.SaveSettings(settings); var cb = new SmartThingsCallbacks(settings); return(!cb.Authorization() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus()); }
public static SettingsProvider CreateSettingsProvider() { var provider = new SettingsProvider("Project/New UI Widgets", SettingsScope.Project) { guiHandler = (searchContext) => { TMProBlock(); DataBindBlock(); }, keywords = SettingsProvider.GetSearchKeywordsFromGUIContentProperties <Styles>(), }; return(provider); }
public MasterkeysProS() { Name = "CM Masterkeys Pro S"; Slug = "cm-masterkeys-pro-s"; CantEnableText = "Couldn't connect to your CM Masterkeys Pro S.\n" + "Please check your cables and try updating your CM software.\n\n" + "If needed, you can select a different keyboard in Artemis under settings."; Height = 6; Width = 18; PreviewSettings = new PreviewSettings(new Rect(13, 12, 657, 219), Resources.masterkeys_pro_s); _generalSettings = SettingsProvider.Load <GeneralSettings>(); }
public static SettingsProvider CreateServicesProvider() { SettingsProvider projectSettings = null; if (ShouldShowBuiltInProjectSettings(BuildService.instance)) { projectSettings = new CloudBuildProjectSettings(BuildService.instance.projectSettingsPath, SettingsScope.Project); } else if (ShouldShowFallbackProjectSettings(BuildService.instance)) { projectSettings = new FallbackProjectSettings(BuildService.instance, SettingsScope.Project); } return(projectSettings); }
public void BasicSaveAndLoadTest() { var provider = new SettingsProvider(); var defaultSettings = provider.LoadSettings<TestSettings>(testSettingsPath); Assert.AreEqual("Default", defaultSettings.Test); var settings1 = new TestSettings() { Test = "Test1" }; provider.SaveSettings(testSettingsPath, settings1); var settings2 = provider.LoadSettings<TestSettings>(testSettingsPath); Assert.AreNotEqual(settings1, settings2); Assert.AreEqual(settings1.Test, settings2.Test); }
public void TestSettings1_SettingsLoaded() { TestSettings1 settings = new TestSettings1(); bool settings_loaded = false; SettingsProvider loaded_provider = null; settings.SettingsLoaded += delegate(object sender, SettingsLoadedEventArgs e) { settings_loaded = true; loaded_provider = e.Provider; }; Assert.AreEqual("root", settings.Username, "A1"); Assert.IsTrue(settings_loaded, "A2"); Assert.AreEqual(loaded_provider, settings.Properties ["Username"].Provider, "A3"); }
public static SettingsProvider PreferencesGUI_SP() { SettingsProvider provider = new SettingsProvider("SabreCSG", SettingsScope.User) { label = "SabreCSG", guiHandler = (searchContext) => { PreferencesGUI(); }, keywords = new HashSet <string>(new[] { "CSG", "SabreCSG", "Sabre" }) }; return(provider); }
public static SettingsProvider CreateFungusSettingsProvider() { // First parameter is the path in the Settings window. // Second parameter is the scope of this setting: it only appears in the Project Settings window. var provider = new SettingsProvider("Project/Fungus", SettingsScope.Project) { // Create the SettingsProvider and initialize its drawing (IMGUI) function in place: guiHandler = (searchContext) => PreferencesGUI() // // Populate the search keywords to enable smart search filtering and label highlighting: // keywords = new HashSet<string>(new[] { "Number", "Some String" }) }; return(provider); }
public MainViewModel(INotificationCenter notificationCenter) { _logger.Log(LogLevel.Info, "============================= NEW APP START ============================= "); _notificationCenter = notificationCenter; CardLookup = new CardLookup(); CardLookup.SearchWanted += (sender, e) => { if (CardLookup.SearchAsYouType) { LookupCards(); } }; DatabaseSummary = string.Format( CultureInfo.CurrentUICulture, "{0} cards from {1} sets", StaticMagicData.CardDefinitions.Count(), StaticMagicData.SetDefinitions.Count()); notificationCenter.NotificationFired += (sender, e) => { _logger.Log(e.LogLevel, e.Message); if (e.LogLevel >= _maxLevel) { StatusBarText = e.Message; } }; // Load the settings var provider = new SettingsProvider(new LocalAppDataStorage("AppSettings")); _settings = provider.GetSettings <SettingsData>(); _maxLevel = LogLevel.FromString(_settings.LogLevel); _currentDataSource = new StaticMagicDataDataSource(); if (!string.IsNullOrEmpty(_settings.LoadedBinder)) { LoadBinder(new DirectoryInfo(PathHelper.UserDataFolder).MakeAbsolutePath(_settings.LoadedBinder)); } Task.Factory.StartNew(() => { LookupSource = LookupSource.ActiveBinder; // LookupCards(); }); }
public static SettingsProvider CreateSettingsProvider() { SettingsProvider provider = new SettingsProvider("Project/Udon Sharp", SettingsScope.Project) { label = "Udon Sharp", keywords = new HashSet <string>(new string[] { "Udon", "Sharp", "U#", "VRC", "VRChat" }), guiHandler = (searchContext) => { UdonSharpSettings settings = UdonSharpSettings.GetOrCreateSettings(); SerializedObject settingsObject = UdonSharpSettings.GetSerializedSettings(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.autoCompileOnModify)), autoCompileLabel); if (settings.autoCompileOnModify) { EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.compileAllScripts)), compileAllLabel); if (!settings.compileAllScripts) { EditorGUILayout.HelpBox("Only compiling the script that has been modified can cause issues if you have multiple scripts communicating via methods.", MessageType.Warning); } } EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.waitForFocus)), waitForFocusLabel); EditorGUILayout.PropertyField(settingsObject.FindProperty("newScriptTemplateOverride"), templateOverrideLabel); EditorGUILayout.Space(); EditorGUILayout.LabelField("Debugging", EditorStyles.boldLabel); EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.buildDebugInfo)), includeDebugInfoLabel); if (settings.buildDebugInfo) { EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.includeInlineCode)), includeInlineCodeLabel); EditorGUILayout.PropertyField(settingsObject.FindProperty(nameof(UdonSharpSettings.listenForVRCExceptions)), listenForVRCExceptionsLabel); } if (EditorGUI.EndChangeCheck()) { settingsObject.ApplyModifiedProperties(); EditorUtility.SetDirty(UdonSharpSettings.GetSettings()); } }, }; return(provider); }
private void Init() { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = SettingsProvider.GetDataSource(); builder.InitialCatalog = SettingsProvider.GetDatabase(); builder.UserID = SettingsProvider.GetUserName(); builder.Password = SettingsProvider.GetPassword(); int type = 2; int entryStatus = 0; int transactionStatus = 0; int defaultAddressType = 0; using (var db = new DeliveryDbContext(builder.ConnectionString)) { var data = from tra_h in db.RBOTRANSACTIONTABLE join tra_i in db.RBOTRANSACTIONINFOCODETRANS on tra_h.TRANSACTIONID equals tra_i.TRANSACTIONID into tra_h_is from tra_h_i in tra_h_is.DefaultIfEmpty() join cust in db.CUSTTABLE on string.IsNullOrEmpty(tra_h_i.INFORMATION) ? tra_h.CUSTACCOUNT : tra_h_i.INFORMATION equals cust.ACCOUNTNUM join cust_ad in db.CUSTOMERADDRESS on cust.ACCOUNTNUM equals cust_ad.ACCOUNTNUM where tra_h_i.INFOCODEID == Program.customerInfoCode && tra_h.TYPE == type && tra_h.ENTRYSTATUS == entryStatus && (from ss in db.RBOTRANSACTIONINFOCODETRANS join ww in db.RBOINFORMATIONSUBCODETABLE on new { p1 = (string)ss.INFOCODEID, p2 = (string)ss.SUBINFOCODEID } equals new { p1 = (string)ww.INFOCODEID, p2 = (string)ww.SUBCODEID } where ss.TRANSACTIONID == tra_h.TRANSACTIONID && ww.INFOCODEID == Program.isDelevary && ww.DESCRIPTION == Program.isDelevaryValue select ss.TRANSACTIONID ).Any() select new TransCust() { ReceiptID = tra_h.RECEIPTID, Customer = string.IsNullOrEmpty(tra_h_i.INFORMATION) ? tra_h.CUSTACCOUNT : tra_h_i.INFORMATION, CustomerName = cust.NAME, CustomerAddredd = cust.ADDRESS, CustomerPhone = string.IsNullOrEmpty(cust_ad.STREET)?cust.PHONE:cust_ad.STREET }; ((ListBox)this.checkedListBoxCustomer).DataSource = data.ToList(); } }
public void AddGroentijdenSetCommand_Executed5TimesWhile5FasenInModel_Adds5GroentijdenSetsWith5FasenToModel() { var model = new ControllerModel(); Messenger.OverrideDefault(FakesCreator.CreateMessenger()); SettingsProvider.OverrideDefault(FakesCreator.CreateSettingsProvider()); DefaultsProvider.OverrideDefault(FakesCreator.CreateDefaultsProvider()); model.Fasen.Add(new FaseCyclusModel() { Naam = "01" }); model.Fasen.Add(new FaseCyclusModel() { Naam = "02" }); model.Fasen.Add(new FaseCyclusModel() { Naam = "03" }); model.Fasen.Add(new FaseCyclusModel() { Naam = "04" }); model.Fasen.Add(new FaseCyclusModel() { Naam = "05" }); var vm = new FasenGroentijdenSetsTabViewModel(); vm.Controller = model; vm.AddGroentijdenSetCommand.Execute(null); vm.AddGroentijdenSetCommand.Execute(null); vm.AddGroentijdenSetCommand.Execute(null); vm.AddGroentijdenSetCommand.Execute(null); vm.AddGroentijdenSetCommand.Execute(null); Assert.AreEqual(5, model.GroentijdenSets.Count); for (var i = 0; i < 5; ++i) { Assert.AreEqual(5, model.GroentijdenSets[i].Groentijden.Count); Assert.AreEqual("01", model.GroentijdenSets[i].Groentijden[0].FaseCyclus); Assert.AreEqual("02", model.GroentijdenSets[i].Groentijden[1].FaseCyclus); Assert.AreEqual("03", model.GroentijdenSets[i].Groentijden[2].FaseCyclus); Assert.AreEqual("04", model.GroentijdenSets[i].Groentijden[3].FaseCyclus); Assert.AreEqual("05", model.GroentijdenSets[i].Groentijden[4].FaseCyclus); } }
public static SettingsProvider ProjectSetting_TinaXMainConfig() { var provider = new SettingsProvider("TinaX/Main", SettingsScope.Project) { label = "基础设置", activateHandler = (searchContext, rootElement) => { mMainConfig = TinaX.Config.CreateIfNotExist <MainConfig>(TinaX.Conf.ConfigPath.main); if (mMainConfig != null) { mSer_MainConfig = new SerializedObject(mMainConfig); if (mSer_MainConfig != null) { mMainConfig_EnableTinaX = mSer_MainConfig.FindProperty("TinaX_Enable"); mMainConfig_StartupScene = mSer_MainConfig.FindProperty("Startup_Scene"); mMainConfig_VersionCode = mSer_MainConfig.FindProperty("Version_Code"); mMainConfig_AppName = mSer_MainConfig.FindProperty("App_Name"); } } }, guiHandler = (searchContext) => { if (mSer_MainConfig != null && mMainConfig != null) { EditorGUILayout.BeginVertical(GUILayout.MaxWidth(500)); EditorGUILayout.PropertyField(mMainConfig_EnableTinaX, new GUIContent("是否启用TinaX Framework")); EditorGUILayout.PropertyField(mMainConfig_StartupScene, new GUIContent("初始化启动场景")); EditorGUILayout.PropertyField(mMainConfig_VersionCode, new GUIContent("当前母包版本号")); EditorGUILayout.PropertyField(mMainConfig_AppName, new GUIContent("应用ID")); EditorGUILayout.EndVertical(); mSer_MainConfig.ApplyModifiedProperties(); } else { GUILayout.Label("未成功加载TinaX 配置文件的有效数据\n可能是文件丢失、损坏、被占用,或者尚未初始化TinaX Framework"); } }, deactivateHandler = () => { } }; return(provider); }
public void Version_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var generalSettingsModel = new GeneralSettingsModel { Version = "5.0.0" }; settingsProvider.SetGeneralSettingsModel(generalSettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(generalSettingsModel.Version, settingsProvider.GetGeneralSettingsModel().Version); }
public static SettingsProvider CreateS2USettingsProvider() { var provider = new SettingsProvider("Project/Spriter2UnityDX", SettingsScope.Project) { guiHandler = (searchContext) => { var settings = S2USettings.GetSerializedSettings(); var label = new GUIContent("Animation Import Style", "By default, animations are nested into the generated prefab. Change this option to instead place animations into a separate folder."); EditorGUILayout.PropertyField(settings.FindProperty("importOption"), label); settings.ApplyModifiedProperties(); }, }; return(provider); }
public void GetOptions_ConfigUpdatedAndAllowReloadsSetToTrue_ProvidesNewOptions() { // Arrange SettingsProvider <ConfigurationSettings> .AllowReload = true; var originalOptions = SettingsProvider <ConfigurationSettings> .GetSection("IocContainer"); SettingsProvider <ConfigurationSettings> .ConfigurationFileName = "appsettings2.json"; // Act var newOptions = SettingsProvider <ConfigurationSettings> .GetSection("IocContainer"); // Assert Assert.AreNotEqual(originalOptions, newOptions); Assert.IsFalse(originalOptions.Equals(newOptions)); Assert.AreNotEqual(originalOptions.Components.Count, newOptions.Components.Count); }
static void Main(string[] args) { var settingsProvider = new SettingsProvider(); var azureStorage = new StorageService(settingsProvider); var service = new DatabankService( settingsProvider, azureStorage, new ConnectionService(), DatabankServiceModule.DataTableCreator); var tableName = "minutas"; var filePrefix = "min"; service.FullUpdateOnTable(tableName, filePrefix); }
public void ClangTidyOnSave_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { TidyOnSave = true }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.TidyOnSave, settingsProvider.GetTidySettingsModel().TidyOnSave); }
public void CustomChecks_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { CustomChecks = "test-check" }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.CustomChecks, settingsProvider.GetTidySettingsModel().CustomChecks); }
public static SettingsProvider CreateMyCustomSettingsProvider() { var provider = new SettingsProvider("Preferences/Directional Sprite Preference", SettingsScope.User) { label = "Directional Sprite Preference", guiHandler = (searchContext) => { var settings = DirectionBillboardSettings.GetSerializedSettings(); EditorGUILayout.PropertyField(settings.FindProperty("currentDirection"), new GUIContent("Forward Position")); settings.ApplyModifiedProperties(); }, keywords = new HashSet <string>(new[] { "Billboard", "Directional Sprite", "Current Direction" }) }; return(provider); }
public void HeaderFilter_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { HeaderFilter = "test" }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.HeaderFilter, settingsProvider.GetTidySettingsModel().HeaderFilter); }
public void ChecksFrom_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { UseChecksFrom = ClangTidyUseChecksFrom.TidyFile }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.UseChecksFrom, settingsProvider.GetTidySettingsModel().UseChecksFrom); }
public void CustomExecutable_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { CustomExecutable = @"D:\Test.exe" }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.CustomExecutable, settingsProvider.GetTidySettingsModel().CustomExecutable); }
public static SettingsProvider CreateKiteSettingsProvider() { SettingsProvider provider = new SettingsProvider(settingsPath, SettingsScope.Project) { label = settingsLabel, guiHandler = (searchContext) => { SerializedObject serializedObject = KiteSettingsEditor.GetSerializedSettings(); EditorHelpers.CreateDefault(serializedObject); serializedObject.ApplyModifiedPropertiesWithoutUndo(); }, keywords = new HashSet <string>(new[] { "Kite", "tileSize" }) }; return(provider); }
/// <summary> /// Forceds the shut down detected. /// </summary> /// <param name="lastHeartBeat">The last heart beat.</param> private void ForcedShutDownDetected(DateTime lastHeartBeat) { bool stopTaskActivity = (bool)SettingsProvider.Get("StopTaskEnabled", false); if (stopTaskActivity == true) { if (SettingsProvider.Get("StopTaskDescription", TaskDescription.Empty) is TaskDescription taskDescription && taskDescription.IsNotEmpty()) { HandleNewTaskActivity(taskDescription, lastHeartBeat); //.AddMinutes(5)); Trace.TraceInformation("AppContext:ForcedShutDownDetected"); } else { Trace.TraceInformation("AppContext:ForcedShutDownDetected - Not handled"); } }
public void FormatAfterTidy_ChangeValue_CompareViewToFile() { var settingsHandler = new SettingsHandler(); var settingsProvider = new SettingsProvider(); var tidySettingsModel = new TidySettingsModel { FormatAfterTidy = true }; settingsProvider.SetTidySettingsModel(tidySettingsModel); settingsHandler.SaveSettings(); settingsHandler.ResetSettings(); settingsHandler.LoadSettings(); Assert.Equal(tidySettingsModel.FormatAfterTidy, settingsProvider.GetTidySettingsModel().FormatAfterTidy); }
public static SettingsProvider CreateSISettingsEditor() { var provider = new SettingsProvider("Preferences/Script Inspector/Editor", SettingsScope.User) { label = "Editor", guiHandler = (searchContext) => { EditorSettings(); }, // Populate the search keywords to enable smart search filtering and label highlighting: //keywords = new HashSet<string>(new[] { "Number", "Some String" }) }; return(provider); }
public SettingsProviderTests() { applicationSettingsStore = Substitute.For<ISettingsStorage>(); backingStore = new Dictionary<string, string>(); applicationSettingsStore.Load("TestSettings.settings").Returns(backingStore); applicationSettingsStore .When(s=>s.Save("TestSettings.settings", Arg.Any<Dictionary<string, string>>())) .Do(c=> { backingStore.Clear(); foreach (var setting in c.Arg<Dictionary<string, string>>()) { backingStore.Add(setting.Key, setting.Value); } }); settingsRetreiver = new SettingsProvider(applicationSettingsStore); settingsSaver = new SettingsProvider(applicationSettingsStore); }
static void Main() { #region Setting initialization settings = new SettingsProvider("settings.info"); settings.AddSetting("PathToDiffEditor", @"D:\Program Files (x86)\WinMerge\WinMergeU.exe"); #endregion #region Repository initialization repoProvider = new RepositoryProvider(SimpleLocalHistory.Program.settings); #endregion #region Service functionality host = new WebServiceHost(typeof(RepositoryService), new Uri(settings.GetStrSettingByName("ServiceUri", "http://localhost:8181/"))); ServiceEndpoint ep = host.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), ""); //DEBUG ServiceDebugBehavior sdb = host.Description.Behaviors.Find<ServiceDebugBehavior>(); sdb.HttpHelpPageEnabled = true; host.Open(); #endregion #region Main App run Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainApp = new MainForm(); mainApp.FormClosing += mainApp_FormClosing; Application.Run(mainApp); #endregion }
private void readSettingsFromProfileDotConfigFile() { var settingsData = new FolderAppSettingsXmlSource(_deployedFolderProfilePath).FindSettingData(); _settingsProvider = SettingsProvider.For(settingsData.ToArray()); }
// Constructors public SettingsLoadedEventArgs(SettingsProvider provider) { }
/// <summary> /// Given certain conditions. /// </summary> protected override void Given() { classUnderTest = new SettingsProvider(titleProvider.Object, descriptionProvider.Object); }
/// <summary> /// Saves all settings specified to the database. /// </summary> /// <param name="settings">Dictionary, which holds the settings as key-value pairs</param> public static void SetSettings(Dictionary<string, string> settings) { if (settings == null) return; SettingsProvider provider = new SettingsProvider(); using (IDbTransaction transaction = Connection.BeginTransaction()) { foreach (KeyValuePair<string, string> setting in settings) { provider.SetValueRaw(setting.Value, setting.Key, transaction); } transaction.Commit(); } }
private void PopulateContent() { SettingsProvider settingsProvider = new SettingsProvider(); settingsProvider.SettingsLoaded += OnSettingLoaded; settingsProvider.RequestSettings(""); }
public SettingsProviderTests() { store = new TestStorage(); settingsRetreiver = new SettingsProvider(store); settingsSaver = new SettingsProvider(store); }
public void SetUp() { var resolver = ObjectResolver.Basic(); _settingsSource = new TestSettingsSource(); theProvider = new SettingsProvider(resolver, new[] { _settingsSource }); }
public SettingsProperty(string name, Type propertyType, SettingsProvider provider, bool isReadOnly, object defaultValue, SettingsSerializeAs serializeAs, SettingsAttributeDictionary attributes, bool throwOnErrorDeserializing, bool throwOnErrorSerializing) { }
public void SetUp() { theSource = new CentralizedSettingsSource("Configuration"); theProvider = new SettingsProvider(ObjectResolver.Basic(), theSource.FindSettingData()); }
public void RemotePort_ReturnsExpectedValue() { // Arrange SettingsProvider settingsProvider = new SettingsProvider(); // Act var result = settingsProvider.RemotePort; // Assert Assert.That(result, Is.EqualTo(4242)); }