예제 #1
0
        public async Task DesktopApp_WithDependencyOnNativePackage_ProducesExpectedOutput(string runtime, string expectedOutputName)
        {
            if (string.IsNullOrEmpty(expectedOutputName))
            {
                expectedOutputName = $"the-win-{RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}-version.txt";
            }

            var testInstance = _testAssetsManager.CreateTestInstance("DesktopAppWithNativeDep")
                .WithLockFiles();

            var publishCommand = new PublishCommand(testInstance.TestRoot, runtime: runtime);
            var result = await publishCommand.ExecuteAsync();

            result.Should().Pass();

            // Test the output
            var outputDir = publishCommand.GetOutputDirectory(portable: false);
            outputDir.Should().HaveFile(expectedOutputName);
            outputDir.Should().HaveFile(publishCommand.GetOutputExecutable());
        }
예제 #2
0
        public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool forceRunnable)
        {
            var runnable = forceRunnable || string.IsNullOrEmpty(runtime) || (RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier().Contains(runtime));

            var testInstance = GetTestInstance()
                .WithLockFiles();

            // Prevent path too long failure on CI machines
            var projectPath = Path.Combine(testInstance.TestRoot, project);
            var publishCommand = new PublishCommand(projectPath, runtime: runtime, output: Path.Combine(projectPath, "out"));
            var result = await publishCommand.ExecuteAsync();

            result.Should().Pass();

            // Test the output
            var outputDir = publishCommand.GetOutputDirectory(portable: false);
            outputDir.Should().HaveFile(libuvName);
            outputDir.Should().HaveFile(publishCommand.GetOutputExecutable());

            Task exec = null;
            if (runnable)
            {
                var outputExePath = Path.Combine(outputDir.FullName, publishCommand.GetOutputExecutable());

                var command = new TestCommand(outputExePath);
                try
                {
                    exec = command.ExecuteAsync(url);
                    NetworkHelper.IsServerUp(url).Should().BeTrue($"Unable to connect to kestrel server - {project} @ {url}");
                    NetworkHelper.TestGetRequest(url, url);
                }
                finally
                {
                    command.KillTree();
                }
                if (exec != null)
                {
                    await exec;
                }
            }
        }
예제 #3
0
        public async Task DesktopApp_WithRuntimes_PublishedSplitPackageAssets()
        {
            var testInstance = _testAssetsManager.CreateTestInstance("DesktopAppWithRuntimes")
                .WithLockFiles();

            var publishCommand = new PublishCommand(testInstance.TestRoot, runtime: "win7-x64");
            var result = await publishCommand.ExecuteAsync();

            result.Should().Pass();

            // Test the output
            var outputDir = publishCommand.GetOutputDirectory(portable: false);
            System.Console.WriteLine(outputDir);
            outputDir.Should().HaveFile("api-ms-win-core-file-l1-1-0.dll");
            outputDir.Should().HaveFile(publishCommand.GetOutputExecutable());
        }