Exemplo n.º 1
0
        /// <summary>
        /// Copy the dependencies from the local repository.
        /// </summary>
        /// <returns>The execution result.</returns>
        public async Task<ExecutionResult> ExecuteAsync()
        {
            try
            {
                // Resolve descriptor path
                string descriptorDirectory = targetfilepath;
                if (!string.IsNullOrWhiteSpace(Path.GetExtension(targetfilepath)))
                {
                    descriptorDirectory = Path.GetDirectoryName(targetfilepath);
                }
                string descriptorPath = Path.Combine(descriptorDirectory, "fadm.xml");

                // Validate file existence
                if (!File.Exists(descriptorPath))
                {
                    return ExecutionResult.Error("The file '{0}' doesn't exist", descriptorPath);
                }

                // Load descriptor
                DescriptorLoader loader = new DescriptorLoader();
                Project project = await loader.LoadAsync(descriptorPath);

                // Return execution result
                return ExecutionResult.Success("Copy executed").With(from d in project.Dependencies select this.ProcessDependencyAsync(d, descriptorDirectory));
            }

            // Report error if any
            catch (Exception exception)
            {
                return ExecutionResult.Error(exception);
            }
        }
Exemplo n.º 2
0
        public void LoadDescriptor(
            int index,
            string expectedName,
            string expectedVersion,
            string expectedCulture,
            string expectedArchitecture)
        {
            // Load the descriptor
            string path = Path.Combine("Ressources", "Project", "SimpleProject.xml");
            Project project = new DescriptorLoader().LoadAsync(path).Result;

            // Assert
            Assert.AreEqual(expectedName, project.Dependencies[index].Name);
            Assert.AreEqual(expectedVersion, project.Dependencies[index].Version.ToString());
            Assert.AreEqual(expectedCulture, project.Dependencies[index].Culture.ToString());
            Assert.AreEqual(expectedArchitecture, project.Dependencies[index].Architecture.ToString());
        }
Exemplo n.º 3
0
 public void Initialize()
 {
     this.DescriptorBuilder = new DescriptorLoader();
 }