public void GetContainedLanguageFactoryForFile_WhenNoActiveIntellisenseProjectHostObject_ReturnsE_FAIL()
        {
            var project    = IVsProject_Factory.ImplementIsDocumentInProject(found: true);
            var properties = ProjectPropertiesFactory.Create(ConfigurationGeneral.SchemaName, ConfigurationGeneral.LanguageServiceIdProperty, LanguageServiceId);
            var containedLanguageFactory = IVsContainedLanguageFactoryFactory.Create();

            var factory = CreateInstance(containedLanguageFactory, hostObject: null, project: project, properties: properties);

            var result = factory.GetContainedLanguageFactoryForFile("FilePath", out var hierarchyResult, out var itemIdResult, out var containedLanguageFactoryResult);

            AssertFailed(result, hierarchyResult, itemIdResult, containedLanguageFactoryResult);
        }
Ejemplo n.º 2
0
        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);
        }