Example #1
0
        public void TestLibraryBindingRedirectGeneration()
        {
            // Set up Test Staging in Temporary Directory
            var root = Temp.CreateDirectory();

            root.CopyDirectory(Path.Combine(_testProjectsRoot, "TestBindingRedirectGeneration"));

            var testProjectsRootDir = Path.Combine(root.Path, "TestBindingRedirectGeneration");
            var greaterTestLibDir   = Path.Combine(testProjectsRootDir, "TestLibraryGreater");
            var lesserTestLibDir    = Path.Combine(testProjectsRootDir, "TestLibraryLesser");

            var lesserTestProject = Path.Combine(lesserTestLibDir, "project.json");
            var publishCommand    = new PublishCommand(lesserTestProject, "net451");

            publishCommand.Execute().Should().Pass();

            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll.config");
            publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.deps");

            // dependencies should also be copied
            publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll");
            publishCommand.GetOutputDirectory().Delete(true);

            publishCommand = new PublishCommand(lesserTestProject, "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier());
            publishCommand.Execute().Should().Pass();

            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb");
            publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.dll.config");
            publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.deps");

            // dependencies should also be copied
            publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll");
        }