public void Copy_Referenced_Files_With_Absolute_Path_To_NewHintPath_Destination() { var project = new ProjectFile { FilePath = @"C:\PathToProject\Project.csproj" }; project.AddReference( "assembly1", @"\\RemoteAbsolutePath\assembly1.dll", @"D:\NewDir\assembly1.dll" ); project.AddReference( "assembly2", @"C:\LocalAbsolutePath\assembly2.dll", @"D:\NewDir\assembly2.dll" ); // WHEN ReferenceMover.MoveReferences( new[] { project } ); // THEN var expectedCopiedFiles = project.References() .Where( r => r.CanBeMoved() ) .Select( r => new Tuple<string, string>( r.HintPath, r.NewHintPath ) ) .ToList(); Assert.That( FileCopyService.CopiedFiles, Is.EquivalentTo( expectedCopiedFiles ) ); }
public void Copy_Referenced_Files_With_Relative_Path_To_NewHintPath_Destination() { var project = new ProjectFile { FilePath = @"C:\PathToProject\Project.csproj" }; project.AddReference( "assembly1", @"..\RelativePath\assembly1.dll", @"D:\NewDir\assembly1.dll" ); project.AddReference( "assembly2", @"assembly2.dll", @"D:\NewDir\assembly2.dll" ); // WHEN ReferenceMover.MoveReferences( new[] { project } ); // THEN var projectDir = Path.GetDirectoryName( project.FilePath ); var expectedCopiedFiles = project.References() .Where( r => r.CanBeMoved() ) .Select( r => new Tuple<string, string>( Path.Combine( projectDir, r.HintPath ), r.NewHintPath ) ) .ToList(); Assert.That( FileCopyService.CopiedFiles, Is.EquivalentTo( expectedCopiedFiles ) ); }