public static Config Clone() { var cfg = new Config(); //var config = // ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); foreach (object key in ConfigurationManager.AppSettings.Keys) { cfg.Set(key.ToString(), Settings(key.ToString(), key.ToString())); } return cfg; }
public static XElement Execute(XElement steps, Browser browser, Config config) { var ret = new XElement(Constants.RESULT); ret.SetAttributeValue("Created", DateTime.UtcNow.ToString(Constants.DATE_TIME_FORMAT)); ret.SetAttributeValue(Constants.RESULT, Constants.SUCCESS); ret.SetAttributeValue(Constants._ID, Guid.NewGuid().ToString()); var instanceId = steps.GetAttributeValue(Constants.INSTANCE_ID); var runtimeId = steps.GetAttributeValue(Constants.RUNTIME_ID); var onError = steps.GetAttributeValue(Constants.ON_ERROR); string link = null; if (!string.IsNullOrEmpty(onError)) ret.SetAttributeValue(Constants.ON_ERROR, onError); if (!string.IsNullOrEmpty(instanceId)) { ret.SetAttributeValue(Constants.INSTANCE_ID, instanceId); browser.DismissUnexpectedAlert(); } if (!string.IsNullOrEmpty(runtimeId)) ret.SetAttributeValue(Constants.RUNTIME_ID, runtimeId); var setEnv = steps.Element(Constants.SET_ENV); if (setEnv != null) { foreach (var env in setEnv.Attributes()) { config.Set(env.Name.ToString(), env.Value); } return ret; } var query = from o in steps.Elements(Constants.STEP) select o; foreach (var step in query) { var xAttribute = step.Attribute(Constants.ACTION); //var xId = step.GetAttributeValue(Constants._ID); if (xAttribute != null) { if (!HandleOneStep(browser, config, ref ret, instanceId, link, step, xAttribute)) break; } } return ret; }