private List<Reference> GetReferences( ProjectFile project ) { return ReferenceFilter.Empty() ? project.References() .Where( r => r.HasHintPath ) .ToList() : project.References() .Where( r => ReferenceFilter.Contains( r.Id ) ) .Where( r => r.HasHintPath ) .ToList(); }
private static void AssertReplaceDefinedHintPaths( ProjectFile projectFile, ProjectFile processedProjectFile ) { foreach( var expectedReference in projectFile.References() ) { var reference = processedProjectFile.References() .Single( i => i.Include == expectedReference.Include ); Assert.That( reference.HintPath, Is.EqualTo( expectedReference.NewHintPath ) ); } }
public ProjectViewModel( ProjectFile projectFile ) { _projectFile = projectFile; _allReferences = _projectFile.References() .Where( r => r.HasHintPath ) .Select( r => new ReferenceViewModel( r ) ) .ToList(); References = _allReferences; }
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 ) ); }