Exemple #1
0
        public void CanSetOutputAssemblyNameForLibraries()
        {
            var testInstance =
                TestAssetsManager
                .CreateTestInstance("LibraryWithOutputAssemblyName")
                .WithLockFiles();

            var root         = testInstance.TestRoot;
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "LibraryWithOutputAssemblyName");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            new DirectoryInfo(outputDir).Should().HaveFiles(new [] { "MyLibrary.dll" });
        }
        public void WrappedProjectFilesResolvedCorrectly()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithWrapperProjectDependency")
                               .WithBuildArtifacts()
                               .WithLockFiles();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "TestApp");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            new DirectoryInfo(outputDir).Should()
            .HaveFiles(new [] { "TestLibrary.dll", "TestLibrary.pdb" });
        }
Exemple #3
0
        public void CanSetOutputAssemblyNameForApps()
        {
            var testInstance =
                TestAssetsManager
                .CreateTestInstance("AppWithOutputAssemblyName")
                .WithLockFiles();

            var root         = testInstance.TestRoot;
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "AppWithOutputAssemblyName");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            new DirectoryInfo(outputDir).Should().HaveFiles(
                new [] { "MyApp.dll", "MyApp" + buildCommand.GetExecutableExtension(),
                         "MyApp.runtimeconfig.json", "MyApp.deps.json" });
        }
Exemple #4
0
        public void CopyToOutputFilesAreCopied()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("EndToEndTestApp")
                               .WithLockFiles()
                               .WithBuildArtifacts();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "EndToEndTestApp");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            var outputDirInfo = new DirectoryInfo(Path.Combine(outputDir, "copy"));

            outputDirInfo.Should().HaveFile("file.txt");
            outputDirInfo.Should().NotHaveFile("fileex.txt");
        }
Exemple #5
0
        public void EmbeddedResourcesAreCopied()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("EndToEndTestApp")
                               .WithLockFiles()
                               .WithBuildArtifacts();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "EndToEndTestApp");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            var objDirInfo = new DirectoryInfo(Path.Combine(root, "obj", "Debug", DefaultFramework));

            objDirInfo.Should().HaveFile("EndToEndTestApp.resource1.resources");
            objDirInfo.Should().HaveFile("myresource.resources");
            objDirInfo.Should().HaveFile("EndToEndTestApp.defaultresource.resources");
        }
Exemple #6
0
        public void ContentFilesAreCopied()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithContentPackage")
                               .WithLockFiles();

            var root = testInstance.TestRoot;

            // run compile
            var outputDir    = Path.Combine(root, "bin");
            var testProject  = ProjectUtils.GetProjectJson(root, "TestAppWithContentPackage");
            var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
            var result       = buildCommand.ExecuteWithCapturedOutput();

            result.Should().Pass();

            result = Command.Create(Path.Combine(outputDir, buildCommand.GetOutputExecutableName()), new string [0])
                     .CaptureStdErr()
                     .CaptureStdOut()
                     .Execute();
            result.Should().Pass();

            // verify the output xml file
            new DirectoryInfo(outputDir).Sub("scripts").Should()
            .Exist()
            .And.HaveFile("run.cmd");
            new DirectoryInfo(outputDir).Should()
            .HaveFile("config.xml");
            // verify embedded resources
            result.StdOut.Should().Contain("TestAppWithContentPackage.dnf.png");
            result.StdOut.Should().Contain("TestAppWithContentPackage.ui.png");
            // verify 'all' language files not included
            result.StdOut.Should().NotContain("TestAppWithContentPackage.dnf_all.png");
            result.StdOut.Should().NotContain("TestAppWithContentPackage.ui_all.png");
            // verify classes
            result.StdOut.Should().Contain("TestAppWithContentPackage.Foo");
            result.StdOut.Should().Contain("MyNamespace.Util");
        }