예제 #1
0
        public void CrossPublishingSucceedsAndHasExpectedArtifacts()
        {
            var          testNugetCache = "packages_cross_publish_test";
            TestInstance instance       = TestAssetsManager.CreateTestInstance(Path.Combine("PortableTests"));

            var testProject = Path.Combine(instance.TestRoot, "StandaloneApp", "project.json");

            var restoreCommand = new RestoreCommand();

            restoreCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
            restoreCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
            restoreCommand.Execute().Should().Pass();

            foreach (var testData in CrossPublishTestData)
            {
                var buildCommand = new BuildCommand(testProject, runtime: testData.Rid);

                buildCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
                buildCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
                buildCommand.Execute().Should().Pass();

                var publishCommand = new PublishCommand(testProject, runtime: testData.Rid, noBuild: true);
                publishCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
                publishCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
                publishCommand.Execute().Should().Pass();

                var publishedDir = publishCommand.GetOutputDirectory();
                publishedDir.Should().HaveFile("StandaloneApp" + testData.HostExtension);

                foreach (var artifact in testData.ExpectedArtifacts)
                {
                    publishedDir.Should().HaveFile(artifact);
                }
            }
        }
예제 #2
0
        private void RunRestore(string args)
        {
            var restoreCommand = new RestoreCommand();

            restoreCommand.Execute($"--quiet {args}").Should().Pass();
        }