public void GetProperties_NotNull() { var provider = new TestSourceFilePropertiesProvider(IUnconfiguredProjectFactory.Create(), WorkspaceFactory.Create(""), IProjectThreadingServiceFactory.Create()); var properties = provider.GetProperties(null, null, null); Assert.NotNull(properties); }
public async void SourceFileProperties_GetUnevalutedPropertyAsync(string code, string propertyName, string expectedValue) { var workspace = WorkspaceFactory.Create(code); var projectFilePath = workspace.CurrentSolution.Projects.First().FilePath; var provider = new TestSourceFilePropertiesProvider(IUnconfiguredProjectFactory.Create(filePath: projectFilePath), workspace, IProjectThreadingServiceFactory.Create()); var properties = provider.GetProperties(projectFilePath, null, null); var propertyValue = await properties.GetUnevaluatedPropertyValueAsync(propertyName); Assert.Equal(expectedValue, propertyValue); }
public async void SourceFileProperties_SetPropertyValueAsync(string code, string propertyName, string propertyValue, string expectedCode) { var language = code.Contains("[") ? LanguageNames.CSharp : LanguageNames.VisualBasic; var workspace = WorkspaceFactory.Create(code, language); var projectFilePath = workspace.CurrentSolution.Projects.First().FilePath; var provider = new TestSourceFilePropertiesProvider(IUnconfiguredProjectFactory.Create(filePath: projectFilePath), workspace, IProjectThreadingServiceFactory.Create()); var properties = provider.GetProperties(projectFilePath, null, null); await properties.SetPropertyValueAsync(propertyName, propertyValue); var newCode = (await workspace.CurrentSolution.Projects.First().Documents.First().GetTextAsync()).ToString(); Assert.Equal(expectedCode, newCode); }
public void GetItemTypeProperties_ThrowsInvalidOperationException() { var provider = new TestSourceFilePropertiesProvider(IUnconfiguredProjectFactory.Create(), WorkspaceFactory.Create(""), IProjectThreadingServiceFactory.Create()); Assert.Throws <InvalidOperationException>(() => provider.GetItemTypeProperties(null)); }
public void DefaultProjectPath() { var provider = new TestSourceFilePropertiesProvider(IUnconfiguredProjectFactory.Create(filePath: "D:\\TestFile"), WorkspaceFactory.Create(""), IProjectThreadingServiceFactory.Create()); Assert.Equal(provider.DefaultProjectPath, "D:\\TestFile"); }