public void TryResolveRazorConfigurationPath_NoIntermediateOutputPath_ReturnsFalse() { // Arrange var projectInstance = new ProjectInstance(ProjectRootElement.Create()); var loggerFactory = Mock.Of <ILoggerFactory>(); var projectLoadListener = new ProjectLoadListener(loggerFactory); // Act var result = ProjectLoadListener.TryResolveRazorConfigurationPath(projectInstance, out var path); // Assert Assert.False(result); Assert.Null(path); }
public void TryResolveRazorConfigurationPath_RootedIntermediateOutputPath_ReturnsTrue() { // Arrange var projectRootElement = ProjectRootElement.Create(); var intermediateOutputPath = "C:\\project\\obj"; projectRootElement.AddProperty(ProjectLoadListener.IntermediateOutputPathPropertyName, intermediateOutputPath); var projectInstance = new ProjectInstance(projectRootElement); var expectedPath = Path.Combine(intermediateOutputPath, ProjectLoadListener.RazorConfigurationFileName); // Act var result = ProjectLoadListener.TryResolveRazorConfigurationPath(projectInstance, out var path); // Assert Assert.True(result); Assert.Equal(expectedPath, path); }
public void TryResolveRazorConfigurationPath_RelativeIntermediateOutputPath_ReturnsTrue() { // Arrange var projectRootElement = ProjectRootElement.Create(); var intermediateOutputPath = "obj"; projectRootElement.AddProperty(ProjectLoadListener.IntermediateOutputPathPropertyName, intermediateOutputPath); // Project directory is automatically set to the current test project (it's a reserved MSBuild property). var projectInstance = new ProjectInstance(projectRootElement); var expectedPath = Path.Combine(intermediateOutputPath, ProjectLoadListener.RazorConfigurationFileName); // Act var result = ProjectLoadListener.TryResolveRazorConfigurationPath(projectInstance, out var path); // Assert Assert.True(result); Assert.NotEmpty(path); }