public void Create_Produces_Formatted_ClassLibrary_Project_File() { _classLibraryProjectFileCreator.Create(); var projectFileContents = File.ReadAllText(_classLibraryProjectFilePath); var expectedProjectFileContents = @"<Project Sdk=""Microsoft.NET.Sdk""> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include=""MyFirstPackage"" Version=""1.0.0"" /> <PackageReference Include=""MySecondPackage"" Version=""2.0.0"" /> </ItemGroup> <ItemGroup> <ProjectReference Include=""TheMainProject"" /> <ProjectReference Include=""TheDependency"" /> </ItemGroup> <ItemGroup Label=""PortingInfo""> <!-- DO NOT REMOVE WHILE PORTING C:\\RandomFile.dll --> </ItemGroup> </Project>"; Assert.AreEqual(expectedProjectFileContents, projectFileContents); }
public Func <string, ProjectType, List <string>, Dictionary <string, string>, List <string>, string> GetMigrateProjectFileAction(string empty) { Func <string, ProjectType, List <string>, Dictionary <string, string>, List <string>, string> func = (string projectDir, ProjectType projectType, List <string> targetVersion, Dictionary <string, string> packageReferences, List <string> projectReferences) => { ProjectFileCreator projectFileCreator = new ProjectFileCreator(projectDir, targetVersion, packageReferences, projectReferences.ToList(), projectType); var result = projectFileCreator.Create(); return(result ? "Project file created" : string.Empty); }; return(func); }