public async Task SinglePackage_StartAsync_CopiesApp()
        {
            using var outputDir = new TempOutputDir();
            var items = new[]
            {
                new DeploymentItem {
                    PackagePath = Path.Combine(TestInfo.OutputDir, "Support", "Packages", "App1")
                }
            };
            var logger = new Mock <ILogger>();
            var task   = new CopyPackagesLocalConcurrentTask(outputDir.TempDir, items, 1, logger.Object);

            await task.StartAsync();

            DirectoryExists(outputDir.TempDir, "App1");
            FileExists(outputDir.TempDir, "App1", "ApplicationManifest.xml");
            DirectoryExists(outputDir.TempDir, "App1", "StatusServicePkg");
            FileExists(outputDir.TempDir, "App1", "StatusServicePkg", "ServiceManifest.xml");
            DirectoryExists(outputDir.TempDir, "App1", "StatusServicePkg", "Code");
            FileExists(outputDir.TempDir, "App1", "StatusServicePkg", "Code", "StatusService.dll");
            FileExists(outputDir.TempDir, "App1", "StatusServicePkg", "Code", "StatusService.exe");
            FileExists(outputDir.TempDir, "App1", "StatusServicePkg", "Code", "StatusService.pdb");
            DirectoryExists(outputDir.TempDir, "App1", "StatusServicePkg", "Config");
            FileExists(outputDir.TempDir, "App1", "StatusServicePkg", "Config", "Settings.xml");
        }
        public async Task SinglePackage_StartAsync_LogsSuccess()
        {
            using var outputDir = new TempOutputDir();
            var packagePath = Path.Combine(TestInfo.OutputDir, "Support", "Packages", "App1");
            var items       = new[] { new DeploymentItem {
                                          PackagePath = packagePath
                                      } };
            var logger = new Mock <ILogger>();
            var task   = new CopyPackagesLocalConcurrentTask(outputDir.TempDir, items, 1, logger.Object);

            await task.StartAsync();

            logger.Verify(l => l.Log(It.Is <LogMessage>(
                                         m => m.Message == "Copy package App1 locally succeeded")), Times.Once);
        }
Example #3
0
        public async Task RunAsync()
        {
            _logger.Log(new LogMessage(
                            StageTypes.Deployment,
                            $"Coping packages to the local working directory...",
                            LogLevelTypes.Ok));

            var items    = _deploymentItems.Select(di => di).ToList();
            var copyTask = new CopyPackagesLocalConcurrentTask(_tempDir, items, items.Count, _logger);
            await copyTask.StartAsync();

            if (!copyTask.HasErrors)
            {
                await _innerCommand.RunAsync();
            }
        }
        public async Task SinglePackage_StartAsync_CreatesTempDir()
        {
            using var outputDir = new TempOutputDir();
            var items = new[]
            {
                new DeploymentItem {
                    PackagePath = Path.Combine(TestInfo.OutputDir, "Support", "Packages", "App1")
                }
            };
            var logger = new Mock <ILogger>();
            var task   = new CopyPackagesLocalConcurrentTask(outputDir.TempDir, items, 1, logger.Object);

            await task.StartAsync();

            var path = Path.Combine(Environment.CurrentDirectory, outputDir.TempDir);

            Directory.Exists(path).ShouldBeTrue();
        }
        public async Task MultiplePackages_StartAsync_UpdatesPackagePaths()
        {
            using var outputDir = new TempOutputDir();
            var items = new[]
            {
                new DeploymentItem {
                    PackagePath = Path.Combine(TestInfo.OutputDir, "Support", "Packages", "App1")
                },
                new DeploymentItem {
                    PackagePath = Path.Combine(TestInfo.OutputDir, "Support", "Packages", "App2")
                }
            };
            var logger = new Mock <ILogger>();
            var task   = new CopyPackagesLocalConcurrentTask(outputDir.TempDir, items, 2, logger.Object);

            await task.StartAsync();

            foreach (var item in items)
            {
                item.PackagePath.ShouldStartWith(outputDir.TempDir);
            }
        }