public void TestSetValueOnExistingKey() { var stfConfiguration = new StfConfiguration(@"TestData\Defaulting\NoDefaultSection.xml"); StfAssert.IsFalse("Trying to set non existing value", stfConfiguration.SetConfigValue("Users.Ulrich.FortyTwo", "New_Ulrich")); string configValue; StfAssert.IsFalse("Can't get value", stfConfiguration.TryGetKeyValue("Users.Ulrich.FortyTwo", out configValue)); }
/// <summary> /// Initializes a new instance of the <see cref="StfKernel"/> class. /// </summary> public StfKernel() { StfTextUtils = new StfTextUtils(); // setup needed kernel directories KernelSetupKernelDirectories(); // lets get a logger and a configuration var uniqueKernelLoggerFilename = StfTextUtils.AppendUniquePartToFileName("KernelLogger.html"); var kernelLoggerFilename = Path.Combine(StfKernelLogDir, uniqueKernelLoggerFilename); var kernelLoggerConfiguration = new StfLoggerConfiguration { LogTitle = "KernelLog", LogFileName = kernelLoggerFilename, LogLevel = StfLogLevel.Internal }; KernelLogger = new StfLogger(kernelLoggerConfiguration); // get the initial configuration together - at this point in time: Only the kernel configuration AssembleStfConfigurationBeforePlugins(); // Any plugins for us? PluginLoader = new StfPluginLoader(KernelLogger, StfConfiguration); PluginLoader.RegisterInstance(typeof(StfConfiguration), StfConfiguration); if (StfConfiguration.TryGetKeyValue("Configuration.StfKernel.PluginPath", out var pluginPath)) { // TODO: Check for existing config file. If file not found then create default template configuration PluginLoader.LoadStfPlugins(pluginPath); } AssembleStfConfigurationAfterPlugins(); // now all configurations are loaded, we can set the Environment. StfConfiguration.Environment = StfConfiguration.DefaultEnvironment; LoadConfigurationForStfTypes(); DumpStfConfiguration(); KernelLogger.LogKeyValue("Stf Root", StfRoot, "The Stf Root directory"); }