Пример #1
0
        public void PublishOptionsTest(string testIdentifier, string framework, string runtime, string config, string outputDir)
        {
            TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", identifier: testIdentifier)
                                                     .WithLockFiles()
                                                     .WithBuildArtifacts();

            string testRoot = _getProjectJson(instance.TestRoot, "TestApp");

            outputDir = string.IsNullOrEmpty(outputDir) ? "" : Path.Combine(instance.TestRoot, outputDir);
            var publishCommand = new PublishCommand(testRoot, output: outputDir);
            publishCommand.Execute().Should().Pass();

            // verify the output executable generated
            var publishedDir = publishCommand.GetOutputDirectory();
            var outputExe = publishCommand.GetOutputExecutable();
            var outputPdb = Path.ChangeExtension(outputExe, "pdb");

            // lets make sure that the output exe is runnable
            var outputExePath = Path.Combine(publishedDir.FullName, publishCommand.GetOutputExecutable());
            var command = new TestCommand(outputExePath);
            command.Execute("").Should().ExitWith(100);

            // the pdb should also be published
            publishedDir.Should().HaveFile(outputPdb);
        }
        public void PublishOptionsTest(string framework, string runtime, string config, string outputDir)
        {
            // create unique directories in the 'temp' folder
            var root = Temp.CreateDirectory();
            var testAppDir = root.CreateDirectory("TestApp");
            var testLibDir = root.CreateDirectory("TestLibrary");

            //copy projects to the temp dir
            CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestApp"), testAppDir);
            CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir);

            RunRestore(testAppDir.Path);
            RunRestore(testLibDir.Path);

            // run publish
            outputDir = string.IsNullOrEmpty(outputDir) ? "" : Path.Combine(root.Path, outputDir);
            var testProject = GetProjectPath(testAppDir);
            var publishCommand = new PublishCommand(testProject, output: outputDir);
            publishCommand.Execute().Should().Pass();

            // verify the output executable generated
            var publishedDir = publishCommand.GetOutputDirectory();
            var outputExe = publishCommand.GetOutputExecutable();
            var outputPdb = Path.ChangeExtension(outputExe, "pdb");

            // lets make sure that the output exe is runnable
            var outputExePath = Path.Combine(publishedDir.FullName, publishCommand.GetOutputExecutable());
            var command = new TestCommand(outputExePath);
            command.Execute("").Should().ExitWith(100);

            // the pdb should also be published
            publishedDir.Should().HaveFile(outputPdb);
        }
Пример #3
0
        public void StandaloneAppHasResourceDependency()
        {
            // WindowsAzure.Services brings in en, zh etc. resource DLLs.
            // The host has to be able to find these assemblies from the deps file
            // from the standalone app base under the ietf tag directory.

            var testName = "TestAppWithResourceDeps";
            TestInstance instance =
                TestAssetsManager
                    .CreateTestInstance(testName)
                    .WithLockFiles()
                    .WithBuildArtifacts();

            var publishCommand = new PublishCommand(instance.TestRoot);
            publishCommand.Execute().Should().Pass();

            var publishedDir = publishCommand.GetOutputDirectory();
            var extension = publishCommand.GetExecutableExtension();
            var outputExe = testName + extension;
            publishedDir.Should().HaveFiles(new[] { $"{testName}.dll", outputExe });

            var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe));
            command.Execute("").Should().ExitWith(0);
        }
Пример #4
0
 public void PublishFailsWhenProjectJsonDoesNotExist()
 {
     using (var dir = new DisposableDirectory(Temp))
     {
         var command = new TestCommand("dotnet");
         string temp = Path.Combine(dir.Path, "project.json");
         command.Execute($"publish {temp}").Should().Fail();
     }
 }
Пример #5
0
 public void PublishFailsWhenProjectRootIsEmpty()
 {
     using (var dir = new DisposableDirectory(Temp))
     {
         var command = new TestCommand("dotnet");
         command.Execute($"publish {dir.Path}").Should().Fail();
     }
 }
Пример #6
0
        public void PublishAppWithOutputAssemblyName()
        {
            TestInstance instance =
                TestAssetsManager
                    .CreateTestInstance("AppWithOutputAssemblyName")
                    .WithLockFiles()
                    .WithBuildArtifacts();

            var testRoot = _getProjectJson(instance.TestRoot, "AppWithOutputAssemblyName");
            var publishCommand = new PublishCommand(testRoot, output: testRoot);
            publishCommand.Execute().Should().Pass();

            var publishedDir = publishCommand.GetOutputDirectory();
            var extension = publishCommand.GetExecutableExtension();
            var outputExe = "MyApp" + extension;
            publishedDir.Should().HaveFiles(new[] { "MyApp.dll", outputExe });
            publishedDir.Should().NotHaveFile("AppWithOutputAssemblyName" + extension);
            publishedDir.Should().NotHaveFile("AppWithOutputAssemblyName.dll");

            var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe));
            command.Execute("").Should().ExitWith(0);
        }
Пример #7
0
        public void TestDotnetRun()
        {
            var restoreCommand = new TestCommand("dotnet");
            restoreCommand.Execute($"restore {TestProject}")
                .Should()
                .Pass();
            var runCommand = new RunCommand(TestProject);

            runCommand.Execute()
                .Should()
                .Pass();
        }