private static KeyValuePair<XDocument, string> LoadAppConfig(TestAlias testAlias, TestApplicationList applications) { var path = Path.GetFullPath(testAlias.Value); var configName = "web.config"; if (testAlias.IsWinAppPath()) { var fileName = Path.GetFileName(applications.Cast<TestApplication>().SelectMany(application => application.AdditionalAttributes).First(attribute => attribute.LocalName.ToLowerInvariant() == "filename").Value); configName = fileName + ".config"; } var configPath = Path.Combine(path, configName); if (File.Exists(configPath)) { using (var streamReader = new StreamReader(configPath)) { return new KeyValuePair<XDocument, string>(XDocument.Load(streamReader), configPath); } } return new KeyValuePair<XDocument, string>(); }
private void CopyModel(ICommandAdapter adapter, TestAlias testAlias, string model, string modelFile){ var copyFileCommand = new CopyFileCommand(); string path1 = testAlias.Value; string destinationFile = Path.Combine(path1, model); var deleteFileCommand = new DeleteFileCommand(); deleteFileCommand.Parameters.MainParameter = new MainParameter(destinationFile); deleteFileCommand.Execute(adapter); copyFileCommand.Execute(adapter, _testParameters, modelFile, destinationFile); if (this.ParameterValue<bool>(IsExternalModel)){ var actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Parameter"); actionCommand.Parameters.ExtraParameter = new MainParameter(Path.GetFileNameWithoutExtension(model)); actionCommand.Execute(adapter); actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Action"); actionCommand.Parameters.ExtraParameter=new MainParameter("LoadModel"); actionCommand.Execute(adapter); } }
private void CopyModel(ICommandAdapter adapter, TestAlias testAlias, string model, string modelFile) { var copyFileCommand = new CopyFileCommand(); string path1 = testAlias.Value; string destinationFile = Path.Combine(path1, model); var deleteFileCommand = new DeleteFileCommand(); deleteFileCommand.Parameters.MainParameter = new MainParameter(destinationFile); deleteFileCommand.Execute(adapter); copyFileCommand.Execute(adapter, _testParameters, modelFile, destinationFile); if (this.ParameterValue <bool>(IsExternalModel)) { var actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Parameter"); actionCommand.Parameters.ExtraParameter = new MainParameter(Path.GetFileNameWithoutExtension(model)); actionCommand.Execute(adapter); actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Action"); actionCommand.Parameters.ExtraParameter = new MainParameter("LoadModel"); actionCommand.Execute(adapter); } }
public void x() { TestAlias t = TestAlias.live; }
private static void UpdateAppConfig(EasyTest easyTest, Options options, TestAlias alias, User user) { var keyValuePair = LoadAppConfig(alias, options.Applications); if (File.Exists(keyValuePair.Value)) { var document = keyValuePair.Key; UpdateAppConfigCore(easyTest, options, user, document); document.Save(keyValuePair.Value); } }