public IProjectInfo FromFile(FileInfo file) { projectInfo = new ProjectInfo(file.Name, file.DirectoryName); var doc = XDocument.Load(file.OpenRead()); var codeFiles = ResolveCodeFiles(doc); foreach (var codeFile in codeFiles) projectInfo.AddCodeFile(codeFile); var references = ResolveReferences(doc); foreach (var reference in references) projectInfo.AddReference(reference); return projectInfo; }
public void ShouldLoadSolutioProjectAndCodeFileInfoFromFile() { var project = new ProjectInfo("ProjectName", "Project", null); projectLoader .Stub(loader => loader.FromFile(Arg<FileInfo>.Matches(file => file.Name == "WellItCouldWork.csproj"))) .Return(project); var solutionInfo = solutionLoader.FromFile(PathToSolution); Assert.That(solutionInfo.Name, Is.EqualTo("WellItCouldWork.sln")); Assert.That(solutionInfo.Path, Is.EqualTo(@"c:\projects\ResolveIt\ResolveIt.Tests\bin\Debug\TestData")); Assert.That(solutionInfo.Projects.Count, Is.EqualTo(1)); var projectInfo = solutionInfo.Projects.First(); Assert.That(projectInfo.Name, Is.EqualTo(project.Name)); Assert.That(projectInfo.Path, Is.EqualTo(project.Path)); Assert.That(projectInfo.Solution, Is.EqualTo(solutionInfo)); }
public InvalidProjectFileComplaint(ProjectInfo projectFile) : base(string.Format("Invalid project file found: {0}", projectFile.Name)) { }