public ProjectInformationResponse CurrentProject(Request request) { var document = _workspace.GetDocument(request.FileName); var msBuildContextProject = _msbuildContext?.GetProject(document?.Project.FilePath); var aspNet5ContextProject = _aspnet5Context?.GetProject(document?.Project.FilePath); MSBuildProject msBuildProjectItem = null; AspNet5Project aspNet5ProjectItem = null; if (msBuildContextProject != null) { msBuildProjectItem = new MSBuildProject(msBuildContextProject); } if (aspNet5ContextProject != null) { aspNet5ProjectItem = new AspNet5Project(aspNet5ContextProject); } return(new ProjectInformationResponse { MsBuildProject = msBuildProjectItem, AspNet5Project = aspNet5ProjectItem }); }
public void CanGetAspNet5Project() { var project1 = CreateProjectWithSourceFile("project1.json", "file1.cs"); var project2 = CreateProjectWithSourceFile("project2.json", "file2.cs"); var project3 = CreateProjectWithSourceFile("project3.json", "file3.cs"); var project = GetProjectContainingSourceFile("file2.cs"); var expectedProject = new AspNet5Project(project2); Assert.Equal(expectedProject.GlobalJsonPath, project.GlobalJsonPath); Assert.Equal(expectedProject.Name, project.Name); Assert.Equal(expectedProject.Path, project.Path); Assert.Equal(expectedProject.Commands.Count, project.Commands.Count); Assert.Equal(expectedProject.Frameworks.Count, project.Frameworks.Count); }