public void AddTenant()
        {
            var registryHost = new InMemoryRegistryHost();
            var hostBuilder  = new WebHostBuilder()
                               .ConfigureServices(services =>
            {
                services.AddNanoFabric(() => registryHost);
            })
                               .Configure(app =>
            {
                app.AddTenant(nameof(ApplicationBuilderExtensionsShould), "1.0.0", new Uri("http://localhost:1234"));

                var serviceRegistry = app.ApplicationServices.GetService <ServiceRegistry>();
                Assert.NotNull(serviceRegistry);

                var instances = serviceRegistry.FindAllServicesAsync().Result;
                Assert.Equal(1, instances.Count);
            });

            using (new TestServer(hostBuilder))
            {
                // ConfigureServices
                // Configure
            }
        }
Esempio n. 2
0
        private async Task <IRegistryHost> GetInMemoryRegistryHostAsync()
        {
            var registryHost = new InMemoryRegistryHost();
            await registryHost.KeyValuePutAsync("key1", "value1");

            await registryHost.KeyValuePutAsync("key2", "value2");

            await registryHost.KeyValuePutAsync("folder/key3", "value3");

            await registryHost.KeyValuePutAsync("folder/key4", "value4");

            return(registryHost);
        }