Example #1
0
        public int Run()
        {
            var evolve = new EvolveBuilder()
                         .Build();

            return(0);
        }
 public void DefaultServicesAreAvailable()
 {
     using (var evolve = new EvolveBuilder()
                         .Build())
     {
         Assert.NotNull(evolve.Services.GetRequiredService <IEvolveEnvironment>());
         Assert.NotNull(evolve.Services.GetRequiredService <IConfiguration>());
         Assert.NotNull(evolve.Services.GetRequiredService <EvolveBuilderContext>());
     }
 }
        public void ConfigureEvolveConfigurationPropagated()
        {
            var evolve = new EvolveBuilder()
                         .ConfigurePreConfiguration(configBuilder =>
            {
                configBuilder.AddInMemoryCollection(new[]
                {
                    new KeyValuePair <string, string>("key1", "value1")
                });
            })
                         .ConfigurePreConfiguration(configBuilder =>
            {
                configBuilder.AddInMemoryCollection(new[]
                {
                    new KeyValuePair <string, string>("key2", "value2")
                });
            })
                         .ConfigurePreConfiguration(configBuilder =>
            {
                configBuilder.AddInMemoryCollection(new[]
                {
                    new KeyValuePair <string, string>("key2", "value3"),
                    new KeyValuePair <string, string>("key3", "value1")
                });
            })
                         .ConfigureEvolveConfiguration((context, configBuilder) =>
            {
                Assert.Equal("value1", context.Configuration["key1"]);
                Assert.Equal("value3", context.Configuration["key2"]);
                configBuilder.AddInMemoryCollection(new[]
                {
                    new KeyValuePair <string, string>("key3", "value2")
                });
            })
                         .Build();

            using (evolve)
            {
                var config = evolve.Services.GetRequiredService <IConfiguration>();
                Assert.Equal("value1", config["key1"]);
                Assert.Equal("value3", config["key2"]);
                Assert.Equal("value2", config["key3"]);
            }
        }
 public void BuildAndDispose()
 {
     using (var evolve = new EvolveBuilder()
                         .Build())
     { }
 }