Ejemplo n.º 1
0
        public void ResolveParamTest2()
        {
            Configuration configuration = null;
            try
            {
                configuration = new Configuration("test");
            }
            catch
            {
            }
            var session = new Session(configuration, Configuration.DefaultViewName);

            try
            {
                if (!configuration.Views.ContainsKey(Configuration.DefaultViewName))
                {
                    configuration.Views.Add(Configuration.DefaultViewName, new CommandNode());
                }
                configuration.Views[Configuration.DefaultViewName].Add(new ViewCommand(session));
                String param = CommandBuilder.ResolveParam("root-view", Configuration.PTypes["view_name_string"]);
                Assert.IsTrue(param == "root-view");
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Method implements loading configuration from the CLISH_PATH environement key.
 /// Configuration class parse defined path and then try deserialize xml config files to
 /// application model objects.
 /// </summary>
 private void PreloadConfiguration()
 {
     // Try to get clish path for preloading commands or another settings.
     String path = Environment.GetEnvironmentVariable(Constants.ClishPath);
     if (String.IsNullOrEmpty(path))
     {
         path = Path.Combine(Directory.GetCurrentDirectory(), Constants.DefaultConfigurationDirectory);
     }
     Log.CoreLog.Info(
         String.Format("Get configuration settings path for loading commands from key: {0} and value: {1}",
                       Constants.ClishPath, path));
     if (!String.IsNullOrEmpty(path))
     {
         Log.CoreLog.Info("Read all files from configuration directory and create prototypes for it.");
         Configuration = new Configuration(path);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Session"/> class.
 /// </summary>
 public Session(Configuration configuration, String viewName)
 {
     Prompt = DefaultPromt;
     Configuration = configuration;
     UpdateSession(viewName, null);
 }