public void TestSkipsRebuildWithTransitiveExeDependency() { var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithTransitiveAppDependency") .WithLockFiles(); TestProjectRoot = testInstance.TestRoot; var buildResult = BuildProject(); buildResult.Should().HaveCompiledProject(MainProject); buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency); buildResult.Should().HaveCompiledProject(AppProject); buildResult.Should().HaveCompiledProject(LibraryProject); buildResult = BuildProject(); buildResult.Should().HaveSkippedProjectCompilation(MainProject); buildResult.Should().HaveSkippedProjectCompilation(TestLibraryWithAppDependency); buildResult.Should().HaveSkippedProjectCompilation(AppProject); buildResult.Should().HaveSkippedProjectCompilation(LibraryProject); }
public void It_returns_null_when_Configuration_is_null() { var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver(); var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName) .WithLockFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "command", CommandArguments = new string[] { "" }, ProjectDirectory = testInstance.Path, Configuration = null, Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 }; var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments); result.Should().BeNull(); }
public void It_copies_ProjectDirectory_contents_to_OutputDirectory_when_the_directories_are_different() { var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestAppSimple", callingMethod: "z") .WithLockFiles().Path; var outputDirectory = Temp.CreateDirectory().Path; var projectDirectoryRelativeFilePaths = EnumerateFilesWithRelativePath(testProjectDirectory); var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(testProjectDirectory, outputDirectory, "1.0.0", mockProj); var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); projectMigrator.Migrate(testSettings); foreach (var projectDirectoryRelativeFilePath in projectDirectoryRelativeFilePaths) { File.Exists(Path.Combine(outputDirectory, projectDirectoryRelativeFilePath)).Should().BeTrue(); } }
public void RefsPublishTest() { TestInstance instance = TestAssetsManager.CreateTestInstance("PortableTests") .WithLockFiles(); var publishCommand = new PublishCommand(Path.Combine(instance.TestRoot, "PortableAppCompilationContext")); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory(true).Should().HaveFile("PortableAppCompilationContext.dll"); var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory(true).FullName, "refs")); // Microsoft.CodeAnalysis.CSharp is IL only refsDirectory.Should().NotHaveFile("Microsoft.CodeAnalysis.CSharp.dll"); // System.IO has facede refsDirectory.Should().HaveFile("System.IO.dll"); // Libraries in which lib==ref should be deduped refsDirectory.Should().NotHaveFile("PortableAppCompilationContext.dll"); }
public void It_has_error_when_migrating_a_deprecated_projectJson() { var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z") .Path; var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj); var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); var report = projectMigrator.Migrate(testSettings); var projectReport = report.ProjectMigrationReports.First(); var errorMessage = projectReport.Errors.First().GetFormattedErrorMessage(); errorMessage.Should().Contain("MIGRATE1011::Deprecated Project:"); errorMessage.Should().Contain("The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead. (line: 6, file:"); errorMessage.Should().Contain("The 'compilationOptions' option is deprecated. Use 'buildOptions' instead. (line: 3, file:"); }
public void It_promotes_P2P_references_up_in_the_dependency_chain() { var solutionDirectory = TestAssetsManager.CreateTestInstance("TestAppDependencyGraph", callingMethod: "p").Path; var appDirectory = Path.Combine(solutionDirectory, "ProjectA"); var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10); var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(appDirectory, appDirectory, "1.0.0", mockProj, null); var testInputs = new MigrationRuleInputs(new[] { projectContext }, mockProj, mockProj.AddItemGroup(), mockProj.AddPropertyGroup()); new MigrateProjectDependenciesRule().Apply(testSettings, testInputs); var projectReferences = mockProj.Items.Where( item => item.ItemType.Equals("ProjectReference", StringComparison.Ordinal)); projectReferences.Count().Should().Be(7); }
public void It_returns_null_when_CommandName_does_not_exist_in_ProjectTools() { var projectToolsCommandResolver = SetupProjectToolsCommandResolver(); var testInstance = TestAssetsManager .CreateTestInstance(TestProjectName) .WithNuGetMSBuildFiles() .WithLockFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "nonexistent-command", CommandArguments = null, ProjectDirectory = testInstance.Path }; var result = projectToolsCommandResolver.Resolve(commandResolverArguments); result.Should().BeNull(); }
public void It_writes_an_sln_file() { var solutionDirectory = TestAssetsManager.CreateTestInstance("TestAppWithSln", callingMethod: "p").Path; var solutionFullPath = Path.Combine(solutionDirectory, "TestAppWithSln.sln"); var slnFile = new SlnFile(); slnFile.Read(solutionFullPath); slnFile.Projects.Count.Should().Be(1); var project = slnFile.Projects[0]; project.Name.Should().Be("TestAppWithSln"); project.Name = "New Project Name"; project.FilePath.Should().Be("TestAppWithSln.xproj"); project.FilePath = "New File Path"; var newSolutionFullPath = Path.Combine(solutionDirectory, "TestAppWithSln_modified.sln"); slnFile.Write(newSolutionFullPath); slnFile = new SlnFile(); slnFile.Read(newSolutionFullPath); slnFile.FormatVersion.Should().Be("12.00"); slnFile.ProductDescription.Should().Be("Visual Studio 14"); slnFile.VisualStudioVersion.Should().Be("14.0.25420.1"); slnFile.MinimumVisualStudioVersion.Should().Be("10.0.40219.1"); slnFile.BaseDirectory.Should().Be(solutionDirectory); slnFile.FileName.FileName.Should().Be("TestAppWithSln_modified.sln"); SlnFile.GetFileVersion(solutionFullPath).Should().Be("12.00"); slnFile.Projects.Count.Should().Be(1); project = slnFile.Projects[0]; project.Id.Should().Be("{0138CB8F-4AA9-4029-A21E-C07C30F425BA}"); project.TypeGuid.Should().Be("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}"); project.Name.Should().Be("New Project Name"); project.FilePath.Should().Be("New File Path"); slnFile.Projects.Count.Should().Be(1); project = slnFile.Projects[0]; }
public void HasIncludedFiles() { var testInstance = TestAssetsManager .CreateTestInstance("EndToEndTestApp") .WithLockFiles() .WithBuildArtifacts(); var cmd = new PackCommand(Path.Combine(testInstance.TestRoot, Project.FileName)); cmd.Execute().Should().Pass(); var outputPackage = Path.Combine(testInstance.TestRoot, "bin", "Debug", "EndToEndTestApp.1.0.0.nupkg"); File.Exists(outputPackage).Should().BeTrue(outputPackage); var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read); zip.Entries.Should().Contain(e => e.FullName == "packfiles/pack1.txt"); zip.Entries.Should().Contain(e => e.FullName == "newpath/pack2.txt"); zip.Entries.Should().Contain(e => e.FullName == "anotherpath/pack2.txt"); }
public void ItRunsKestrelStandaloneAfterPublish() { TestInstance instance = TestAssetsManager.CreateTestInstance(KestrelSampleBase) .WithLockFiles(); var url = NetworkHelper.GetLocalhostUrlWithFreePort(); var args = $"{url} {Guid.NewGuid().ToString()}"; var output = Publish(Path.Combine(instance.TestRoot, KestrelStandalone), false); var command = new TestCommand(output); try { command.ExecuteAsync($"{args}"); NetworkHelper.IsServerUp(url).Should().BeTrue($"Unable to connect to kestrel server - {KestrelStandalone} @ {url}"); NetworkHelper.TestGetRequest(url, args); } finally { command.KillTree(); } }
private ProjectRootElement MigrateProject(string solution, string project) { var solutionDirectory = TestAssetsManager.CreateTestInstance(solution, callingMethod: "p").Path; var appDirectory = Path.Combine(solutionDirectory, project); var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10); var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(appDirectory, appDirectory, "1.0.0", mockProj, null); var testInputs = new MigrationRuleInputs(new[] { projectContext }, mockProj, mockProj.AddItemGroup(), mockProj.AddPropertyGroup()); new MigrateProjectDependenciesRule().Apply(testSettings, testInputs); var s = mockProj.Items.Select(p => $"ItemType = {p.ItemType}, Include = {p.Include}"); Console.WriteLine(string.Join(Environment.NewLine, s)); return(mockProj); }
public void Project_dependencies_are_migrated_to_ProjectReference() { var solutionDirectory = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: "p").Path; var appDirectory = Path.Combine(solutionDirectory, "TestApp"); var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10); var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(appDirectory, appDirectory, "1.0.0", mockProj, null); var testInputs = new MigrationRuleInputs(new[] { projectContext }, mockProj, mockProj.AddItemGroup(), mockProj.AddPropertyGroup()); new MigrateProjectDependenciesRule().Apply(testSettings, testInputs); var projectReferences = mockProj.Items.Where(item => item.ItemType.Equals("ProjectReference", StringComparison.Ordinal)); projectReferences.Count().Should().Be(1); projectReferences.First().Include.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj")); }
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"); }
public void TestIncrementalBuildOfDependencyGraph(string testIdentifer, string projectToTouch, string[] expectedRebuiltProjects) { var testInstance = TestAssetsManager.CreateTestInstance("TestProjectToProjectDependencies", identifier: testIdentifer) .WithLockFiles() .WithBuildArtifacts(); TestProjectRoot = testInstance.TestRoot; // second build; nothing changed; no project required compilation var result2 = BuildProject(); AssertRebuilt(result2, Array.Empty <string>()); //modify the source code of a project TouchSourcesOfProject(projectToTouch); // third build; all projects on the paths from touched project to root project need to be rebuilt var result3 = BuildProject(); AssertRebuilt(result3, expectedRebuiltProjects); }
public void WhenPassedMultipleProjectsAndOneOfthemDoesNotExistItCancelsWholeOperation() { var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppWithSlnAndCsprojFiles") .WithLockFiles() .Path; var slnFullPath = Path.Combine(projectDirectory, "App.sln"); var contentBefore = File.ReadAllText(slnFullPath); var projectToAdd = Path.Combine("Lib", "Lib.csproj"); var cmd = new DotnetCommand() .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput($"add App.sln project {projectToAdd} idonotexist.csproj"); cmd.Should().Fail(); cmd.StdErr.Should().Contain("does not exist"); cmd.StdErr.Should().NotMatchRegex("(.*does not exist.*){2,}"); File.ReadAllText(slnFullPath) .Should().BeEquivalentTo(contentBefore); }
public void It_migrates_dotnet_new_console_with_identical_outputs() { var testInstance = TestAssetsManager .CreateTestInstance("ProjectJsonConsoleTemplate"); var projectDirectory = testInstance.Path; var outputComparisonData = GetComparisonData(projectDirectory); var outputsIdentical = outputComparisonData.ProjectJsonBuildOutputs.SetEquals(outputComparisonData.MSBuildBuildOutputs); if (!outputsIdentical) { OutputDiagnostics(outputComparisonData); } outputsIdentical.Should().BeTrue(); VerifyAllMSBuildOutputsRunnable(projectDirectory); }
private void StandaloneApp_WithoutCoreClrDll_Fails() { // Convert a Portable App to Standalone to simulate the customer scenario var testInstance = TestAssetsManager.CreateTestInstance("DependencyChangeTest") .WithLockFiles(); // Convert the portable test project to standalone by removing "type": "platform" and adding rids var originalTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json"); var modifiedTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json.modified"); // Simulate a user editting the project.json File.Delete(originalTestProject); File.Copy(modifiedTestProject, originalTestProject); var buildResult = new BuildCommand(originalTestProject, framework: DefaultFramework) .ExecuteWithCapturedOutput(); buildResult.Should().Fail(); buildResult.StdErr.Should().Contain("Expected coreclr library not found in package graph. Please try running dotnet restore again."); }
public void SettingVersionInEnvironment_ShouldStampAssemblyInfoInOutputAssembly() { var testInstance = TestAssetsManager.CreateTestInstance("TestLibraryWithConfiguration") .WithLockFiles(); var cmd = new BuildCommand(Path.Combine(testInstance.TestRoot, Project.FileName), framework: DefaultLibraryFramework); cmd.Environment["DOTNET_BUILD_VERSION"] = "85"; cmd.Environment["DOTNET_ASSEMBLY_FILE_VERSION"] = "345"; cmd.ExecuteWithCapturedOutput().Should().Pass(); var output = Path.Combine(testInstance.TestRoot, "bin", "Debug", DefaultLibraryFramework, "TestLibraryWithConfiguration.dll"); var informationalVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyInformationalVersionAttribute"); var fileVersion = PeReaderUtils.GetAssemblyAttributeValue(output, "AssemblyFileVersionAttribute"); informationalVersion.Should().NotBeNull(); informationalVersion.Should().BeEquivalentTo("1.0.0-85"); fileVersion.Should().NotBeNull(); fileVersion.Should().BeEquivalentTo("1.0.0.345"); }
public GivenThatWeWantToRunTestsInTheConsole() { var testInstance = TestAssetsManager.CreateTestInstance(Path.Combine("ProjectsWithTests", "NetCoreAppOnlyProject"), identifier: "ConsoleTests"); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); var contexts = ProjectContext.CreateContextForEachFramework( _projectFilePath, null, RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers()); // Restore the project again in the destination to resolve projects // Since the lock file has project relative paths in it, those will be broken // unless we re-restore new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass(); _defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); }
public void It_throws_when_project_dependency_is_unresolved() { // No Lock file => unresolved var solutionDirectory = TestAssetsManager.CreateTestInstance("TestAppWithLibrary").Path; var appDirectory = Path.Combine(solutionDirectory, "TestApp"); var libraryDirectory = Path.Combine(solutionDirectory, "TestLibrary"); Directory.Delete(libraryDirectory, true); var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10); var mockProj = ProjectRootElement.Create(); var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(appDirectory, appDirectory, mockProj); var testInputs = new MigrationRuleInputs(new[] { projectContext }, mockProj, mockProj.AddItemGroup(), mockProj.AddPropertyGroup()); Action action = () => new MigrateProjectDependenciesRule().Apply(testSettings, testInputs); action.ShouldThrow <Exception>() .Where(e => e.Message.Contains("MIGRATE1014::Unresolved Dependency: Unresolved project dependency (TestLibrary)")); }
public void RefsPublishTest() { TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppCompilationContext") .WithLockFiles() .WithBuildArtifacts(); var testProject = _getProjectJson(instance.TestRoot, "TestApp"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestApp.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll"); var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory().FullName, "refs")); // Should have compilation time assemblies refsDirectory.Should().HaveFile("System.IO.dll"); // Libraries in which lib==ref should be deduped refsDirectory.Should().NotHaveFile("TestLibrary.dll"); }
//no global.json //[InlineData(false, null, null, "TestLibrary/bin/debug/{fw}", "TestApp/bin/debug/{fw}", "TestApp/bin/debug/{fw}/{rid}")] //[InlineData(false, "out", null, "TestLibrary/bin/debug/{fw}", "TestApp/bin/debug/{fw}", "out")] //[InlineData(false, null, "build", "build/TestLibrary/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}/{rid}")] //[InlineData(false, "out", "build", "build/TestLibrary/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}", "out")] public void DefaultPaths(string testIdentifer, bool global, string outputValue, string baseValue, string expectedLibCompile, string expectedAppCompile, string expectedAppRuntime) { var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", identifier: testIdentifer) .WithLockFiles(); GetProjectInfo(testInstance.TestRoot); new BuildCommand(GetProjectPath(_testAppDirDirInfo), output: outputValue != null ? Path.Combine(_testProjectsRoot, outputValue) : string.Empty, buidBasePath: baseValue != null ? Path.Combine(_testProjectsRoot, baseValue) : string.Empty, framework: DefaultFramework) .ExecuteWithCapturedOutput().Should().Pass(); var libdebug = _rootDirInfo.Sub(FormatPath(expectedLibCompile, DefaultFramework, _runtime)); var appdebug = _rootDirInfo.Sub(FormatPath(expectedAppCompile, DefaultFramework, _runtime)); var appruntime = _rootDirInfo.Sub(FormatPath(expectedAppRuntime, DefaultFramework, _runtime)); libdebug.Should().Exist().And.HaveFiles(_libCompileFiles); appdebug.Should().Exist().And.HaveFiles(_appCompileFiles); appruntime.Should().Exist().And.HaveFiles(_runtimeFiles); }
public void TestNoDependenciesDependencyRebuild() { var testInstance = TestAssetsManager.CreateTestInstance("TestProjectToProjectDependencies") .WithLockFiles() .WithBuildArtifacts(); TestProjectRoot = testInstance.TestRoot; // modify the source code of a leaf dependency TouchSourcesOfProject("L11"); // second build with no dependencies, rebuilding leaf var result2 = new BuildCommand(GetProjectDirectory("L11"), noDependencies: true, framework: DefaultLibraryFramework).ExecuteWithCapturedOutput(); result2.Should().HaveStdOutMatching("Compiling.*L11.*"); // third build with no dependencies but incremental; root project should rebuild var result3 = BuildProject(noDependencies: true); result3.Should().HaveCompiledProject("L0", _appFrameworkFullName); }
public void TestWillCreateTrxLogger() { // Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCore"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; // Restore project VSTestDotNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TestResults"); // Delete trxLoggerDirectory if it exist if (Directory.Exists(trxLoggerDirectory)) { Directory.Delete(trxLoggerDirectory, true); } // Call test with logger enable CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) .ExecuteWithCapturedOutput("--logger:trx"); // Verify String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx"); Assert.Equal(1, trxFiles.Length); result.StdOut.Should().Contain(trxFiles[0]); // Cleanup trxLoggerDirectory if it exist if (Directory.Exists(trxLoggerDirectory)) { Directory.Delete(trxLoggerDirectory, true); } }
public void It_migrates_signed_apps() { var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppWithSigning").WithLockFiles().Path; CleanBinObj(projectDirectory); var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, "TestAppWithSigning"); var outputsIdentical = outputComparisonData.ProjectJsonBuildOutputs.SetEquals(outputComparisonData.MSBuildBuildOutputs); if (!outputsIdentical) { OutputDiagnostics(outputComparisonData); } outputsIdentical.Should().BeTrue(); VerifyAllMSBuildOutputsRunnable(projectDirectory); VerifyAllMSBuildOutputsAreSigned(projectDirectory); }
private void StandaloneApp_WithoutCoreClrDll_Fails() { // Convert a Portable App to Standalone to simulate the customer scenario var testInstance = TestAssetsManager.CreateTestInstance("DependencyChangeTest") .WithLockFiles(); // Convert the portable test project to standalone by removing "type": "platform" and adding rids var originalTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json"); var modifiedTestProject = Path.Combine(testInstance.TestRoot, "PortableApp_Standalone", "project.json.modified"); // Simulate a user editting the project.json File.Delete(originalTestProject); File.Copy(modifiedTestProject, originalTestProject); var buildResult = new BuildCommand(originalTestProject, framework: DefaultFramework) .ExecuteWithCapturedOutput(); buildResult.Should().Fail(); buildResult.StdErr.Should().Contain("Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes"); buildResult.StdErr.Should().Contain("The project has not been restored or restore failed - run `dotnet restore`"); }
public void ItCopiesProjectDirectoryContentsToOutputDirectoryWhenTheDirectoriesAreDifferent() { var testProjectDirectory = TestAssetsManager .CreateTestInstance("PJTestAppSimple", callingMethod: "z") .Path; var outputDirectory = Temp.CreateDirectory().Path; var projectDirectoryRelativeFilePaths = EnumerateFilesWithRelativePath(testProjectDirectory); var mockProj = ProjectRootElement.Create(); var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(testProjectDirectory, outputDirectory, mockProj); var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); projectMigrator.Migrate(testSettings); foreach (var projectDirectoryRelativeFilePath in projectDirectoryRelativeFilePaths) { File.Exists(Path.Combine(outputDirectory, projectDirectoryRelativeFilePath)).Should().BeTrue(); } }
public void TestProjectToolIsAvailableThroughDriver(string appName) { var testInstance = TestAssetsManager .CreateTestInstance(appName, identifier: appName) .WithLockFiles(); var appDirectory = testInstance.Path; new BuildCommand(Path.Combine(appDirectory, "project.json")) .Execute() .Should() .Pass(); CommandResult result = new PortableCommand { WorkingDirectory = appDirectory } .ExecuteWithCapturedOutput(); result.Should().HaveStdOutContaining("Hello Portable World!" + Environment.NewLine); result.Should().NotHaveStdErr(); result.Should().Pass(); }
public void It_passes_depsfile_arg_to_host_when_returning_a_CommandSpec() { var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver(); var testInstance = TestAssetsManager.CreateTestInstance(ProjectJsonTestProjectName) .WithBuildArtifacts() .WithLockFiles(); var commandResolverArguments = new CommandResolverArguments() { CommandName = "dotnet-hello", CommandArguments = null, ProjectDirectory = testInstance.Path, Configuration = "Debug", Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10 }; var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments); result.Should().NotBeNull(); result.Args.Should().Contain("--depsfile"); }
public void It_builds_projects_with_xmlDoc_and_spaces_in_the_path() { var testInstance = TestAssetsManager .CreateTestInstance("TestLibraryWithXmlDoc", identifier: "With Space") .WithLockFiles(); testInstance.TestRoot.Should().Contain(" "); var output = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "output")); new BuildCommand("", output: output.FullName, framework: DefaultLibraryFramework) .WithWorkingDirectory(testInstance.TestRoot) .ExecuteWithCapturedOutput() .Should() .Pass(); output.Should().HaveFiles(new[] { "TestLibraryWithXmlDoc.dll", "TestLibraryWithXmlDoc.xml" }); }