public void SingleFileGeneratorFactoryAggregator_NoGeneratorId_ReturnsFail()
        {
            UnitTestHelper.IsRunningUnitTests = true;
            var manager            = CreateManagerForPath($"Generators\\{PackageGuid.ToString("B").ToUpper()}");
            var serviceProvider    = IServiceProviderFactory.ImplementGetService(type => manager);
            var integrationService = IVsUnconfiguredProjectIntegrationServiceFactory.ImplementProjectTypeGuid(PackageGuid);

            var aggregator = new SingleFileGeneratorFactoryAggregator(serviceProvider, integrationService);

            Assert.Equal(VSConstants.E_FAIL,
                         aggregator.GetGeneratorInformation("ResXCodeFileGenerator", out int actualDesignTime, out int actualSharedDesignTime, out int actualCompileFlag, out Guid actualGuid));
        }
        public void SingleFileGeneratorFactoryAggregator_GivenValidRegistry_OptionalParamsAreOptional()
        {
            UnitTestHelper.IsRunningUnitTests = true;
            var manager            = CreateManager();
            var serviceProvider    = IServiceProviderFactory.ImplementGetService(type => manager);
            var integrationService = IVsUnconfiguredProjectIntegrationServiceFactory.ImplementProjectTypeGuid(PackageGuid);

            var aggregator = new SingleFileGeneratorFactoryAggregator(serviceProvider, integrationService);

            Assert.Equal(VSConstants.S_OK,
                         aggregator.GetGeneratorInformation("ResXCodeFileGenerator", out int actualDesignTime, out int actualSharedDesignTime, out int actualCompileFlag, out Guid actualGuid));

            Assert.Equal(0, actualDesignTime);
            Assert.Equal(0, actualSharedDesignTime);
            Assert.Equal(0, actualCompileFlag);
            Assert.Equal(ResXGuid, actualGuid);
        }
Exemplo n.º 3
0
        public void SingleFileGeneratorFactoryAggregator_GivenValidRegistry_RetrievesData(int designTimeSource, int sharedDesignTimeSource, int compileFlag)
        {
            UnitTestHelper.IsRunningUnitTests = true;
            var manager         = CreateManager(true, designTimeSource, sharedDesignTimeSource, compileFlag);
            var serviceProvider = IServiceProviderFactory.ImplementGetService(type => manager);

            var integrationService = IVsUnconfiguredProjectIntegrationServiceFactory.ImplementProjectTypeGuid(PackageGuid);

            var aggregator = new SingleFileGeneratorFactoryAggregator(serviceProvider, integrationService);

            int  actualDesignTime;
            int  actualSharedDesignTime;
            int  actualCompileFlag;
            Guid actualGuid;

            Assert.Equal(VSConstants.S_OK,
                         aggregator.GetGeneratorInformation("ResXCodeFileGenerator", out actualDesignTime, out actualSharedDesignTime, out actualCompileFlag, out actualGuid));

            Assert.Equal(designTimeSource == 1 ? 1 : 0, actualDesignTime);
            Assert.Equal(sharedDesignTimeSource == 1 ? 1 : 0, actualSharedDesignTime);
            Assert.Equal(compileFlag == 1 ? 1 : 0, actualCompileFlag);
            Assert.Equal(ResXGuid, actualGuid);
        }