public void GetContainedLanguageFactoryForFile_WhenFilePathNotFound_ReturnE_FAIL() { var project = IVsProject_Factory.ImplementIsDocumentInProject(found: false); var factory = CreateInstance(project: project); var result = factory.GetContainedLanguageFactoryForFile("FilePath", out var hierarchyResult, out var itemIdResult, out var containedLanguageFactoryResult); AssertFailed(result, hierarchyResult, itemIdResult, containedLanguageFactoryResult); }
public void GetContainedLanguageFactoryForFile_WhenNoContainedLanguageFactory_ReturnE_FAIL() { var project = IVsProject_Factory.ImplementIsDocumentInProject(found: true); var properties = ProjectPropertiesFactory.Create(ConfigurationGeneral.SchemaName, ConfigurationGeneral.LanguageServiceIdProperty, LanguageServiceId); var factory = CreateInstance((IVsContainedLanguageFactory)null, project: project, properties: properties); var result = factory.GetContainedLanguageFactoryForFile("FilePath", out var hierarchyResult, out var itemIdResult, out var containedLanguageFactoryResult); AssertFailed(result, hierarchyResult, itemIdResult, containedLanguageFactoryResult); }
public void GetContainedLanguageFactoryForFile_WhenLanguageServiceIdEmptyOrInvalid_ReturnE_FAIL(string languageServiceId) { var project = IVsProject_Factory.ImplementIsDocumentInProject(found: true); var properties = ProjectPropertiesFactory.Create(ConfigurationGeneral.SchemaName, ConfigurationGeneral.LanguageServiceIdProperty, languageServiceId); var hostObject = IConfiguredProjectHostObjectFactory.Create(); var factory = CreateInstance(hostObject: hostObject, project: project, properties: properties); var result = factory.GetContainedLanguageFactoryForFile("FilePath", out var hierarchyResult, out var itemIdResult, out var containedLanguageFactoryResult); AssertFailed(result, hierarchyResult, itemIdResult, containedLanguageFactoryResult); }
public void GetContainedLanguageFactoryForFile_WhenReturnsResult_ReturnsS_OK() { var hierarchy = IVsHierarchyFactory.Create(); var project = IVsProject_Factory.ImplementIsDocumentInProject(found: true, itemid: 1); var properties = ProjectPropertiesFactory.Create(ConfigurationGeneral.SchemaName, ConfigurationGeneral.LanguageServiceIdProperty, LanguageServiceId); var containedLanguageFactory = IVsContainedLanguageFactoryFactory.Create(); var factory = CreateInstance(containedLanguageFactory, hierarchy: hierarchy, project: project, properties: properties); var result = factory.GetContainedLanguageFactoryForFile("FilePath", out var hierarchyResult, out var itemIdResult, out var containedLanguageFactoryResult); Assert.Equal(VSConstants.S_OK, result); Assert.Same(hierarchy, hierarchyResult); Assert.Same(containedLanguageFactory, containedLanguageFactoryResult); Assert.Equal(1u, itemIdResult); }