Example #1
0
 public void InstallError(string fileName)
 {
     ExecutionResult result = new InstallTask(fileName).ExecuteAsync().Result;
     Assert.AreEqual(ExecutionResultStatus.Error, result.Status);
 }
Example #2
0
        public void InstallSuccess(
            string ressourceFile,
            string dependencyName,
            string dependencyVersion,
            string dependencyExtension,
            bool pdbFound)
        {
            // Compute dependency path
            string dependencyDirectoryPath = FileSystem.ComputeDependencyDirectoryPath(dependencyName, dependencyVersion);
            string dependencyFilePath = FileSystem.ComputeDependencyFilePath(dependencyName, dependencyVersion, dependencyExtension);
            string ressourceFilePath = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", Path.Combine("Ressources", "Assembly", ressourceFile), dependencyExtension);

            // Remove the dependency path if it exists
            if (Directory.Exists(dependencyDirectoryPath))
            {
                Directory.Delete(dependencyDirectoryPath, true);
            }

            // Assert initial status
            Assert.AreEqual(true, File.Exists(ressourceFilePath));
            Assert.AreEqual(false, Directory.Exists(dependencyDirectoryPath));
            Assert.AreEqual(false, File.Exists(dependencyFilePath));

            // Trigger install
            ExecutionResult result = new InstallTask(ressourceFilePath).ExecuteAsync().Result;

            // Assert output
            List<ExecutionResult> executionResult = result.BlockingSubExecutionResults.ToList();
            Assert.AreEqual(ExecutionResultStatus.Success, result.Status);
            Assert.AreEqual(2, executionResult.Count);
            Assert.AreEqual(true, Directory.Exists(dependencyDirectoryPath));
            Assert.AreEqual(true, File.Exists(dependencyFilePath));

            // Assert when pdb should be found
            if (pdbFound)
            {
                Assert.IsTrue(executionResult.All(e => ExecutionResultStatus.Success == e.Status));
                Assert.IsTrue(executionResult.All(e => e.Message.Contains("installed to")));
            }

            // Assert when pdb should not be found
            else
            {
                ExecutionResult dllExecutionResult = executionResult.Where(e => e.Message.Contains("installed to")).First();
                ExecutionResult pdbExecutionResult = executionResult.Where(e => e.Message.Contains("Could not find")).First();
                Assert.AreEqual(ExecutionResultStatus.Success, dllExecutionResult.Status);
                Assert.IsTrue(dllExecutionResult.Message.Contains("installed to"));
                Assert.AreEqual(ExecutionResultStatus.Warning, pdbExecutionResult.Status);
                Assert.IsTrue(pdbExecutionResult.Message.Contains("Could not find"));
            }
        }
Example #3
0
        public void CopySuccess(
            string dependencyName,
            string dependencyVersion,
            string dependencyExtension,
            string descriptorPath,
            string descriptorName,
            int index)
        {
            // Compute dependency path
            string dependencyFilePath = FileSystem.ComputeDependencyFilePath(dependencyName, dependencyVersion, dependencyExtension);
            string fileName = FileSystem.ComputeFileName(dependencyName, dependencyVersion, dependencyExtension);
            string descriptorLocation = Path.Combine("Ressources", descriptorPath, descriptorName);
            string copiedDependencyLocation = Path.Combine("Ressources", descriptorPath, "dependency");

            // Remove the dependency path if it exists
            if (Directory.Exists(copiedDependencyLocation))
            {
                Directory.Delete(copiedDependencyLocation, true);
            }

            // Trigger install
            ExecutionResult install1result = new InstallTask(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", Path.Combine("Ressources", "Assembly", "UTSampleWithPdb"), "dll")).ExecuteAsync().Result;
            ExecutionResult install2result = new InstallTask(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", Path.Combine("Ressources", "Assembly", "UTSample"), "dll")).ExecuteAsync().Result;

            // Trigger copy
            ExecutionResult resultCopy = new CopyTask(descriptorLocation).ExecuteAsync().Result;
            Assert.AreEqual(ExecutionResultStatus.Success, resultCopy.Status);

            // Assert output
            List<ExecutionResult> executionResults = resultCopy.BlockingSubExecutionResults.ToList();
            Assert.AreEqual(true, Directory.Exists(copiedDependencyLocation));
            Assert.AreEqual(true, File.Exists(Path.Combine(copiedDependencyLocation, fileName)));
            Assert.AreEqual(ExecutionResultStatus.Success, executionResults[index].Status);
            Assert.AreEqual(true, executionResults[index].Message.StartsWith("Restored dependency"));
        }