private static IServiceProvider GetServiceProvider(BuildpackDetectCommand cmd) { var env = new TestEnvironment(); env.SetEnvironmentVariable("NODE_SUPPORTED_VERSIONS", NodeScriptGeneratorOptionsSetup.NodeLtsVersion); var svcProvider = new ServiceProviderBuilder() .ConfigureServices(svcs => svcs.Replace(ServiceDescriptor.Singleton(typeof(IEnvironment), env))) .ConfigureScriptGenerationOptions(opts => cmd.ConfigureBuildScriptGeneratorOptions(opts)) .Build(); return(svcProvider); }
private static IServiceProvider GetServiceProvider(BuildpackDetectCommand cmd) { var svcProvider = new ServiceProviderBuilder() .ConfigureServices(svcs => { var configuration = new ConfigurationBuilder().Build(); svcs.AddSingleton <IConfiguration>(configuration); svcs.AddSingleton <INodeVersionProvider, TestNodeVersionProvider>(); svcs.AddSingleton <IPhpVersionProvider, TestPhpVersionProvider>(); }) .ConfigureScriptGenerationOptions(opts => cmd.ConfigureBuildScriptGeneratorOptions(opts)) .Build(); return(svcProvider); }