public void FullConfiguration_SetCustomPackageNameAndSection_ProviderIsConfigured() { // Arrange var config = new ServiceFabricConfiguration { ConfigPackageName = "TestConfig", ConfigSectionName = "Toggles" }; // Act and Assert Should.NotThrow(() => ServiceFabricConfigProvider.Configure(config)); }
public void FeatureEnabled_ToggleNameIsWithoutPrefixAndConfigured_ToggleValueIsTrue() { // Arrange ServiceFabricConfigProvider.Configure(usePrefix: false); SetToggleInConfig(nameof(TestFeatureToggle), bool.TrueString); var toggle = new TestFeatureToggle(); // Act var toggleValue = toggle.FeatureEnabled; // Assert toggleValue.ShouldBeTrue(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); ServiceFabricConfigProvider.Configure("Config", "Features", true); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/$ProxyUpdate", async(context) => { await ServiceFabricConfigProvider.Update(); await context.Response.WriteAsync("Updated."); }); endpoints.MapGet("/$ProxyConfig", async(context) => { await context.Response.WriteAsync(System.Text.Json.JsonSerializer.Serialize(ServiceFabricConfigProvider.GetCurrentConfig(), typeof(ServiceFabricConfig), new System.Text.Json.JsonSerializerOptions() { WriteIndented = true })); }); endpoints.MapReverseProxy(); }); }
public void FullConfiguration_ConfigurationIsNull_ThrowsArgumentNullException() { Should.Throw <ArgumentNullException>(() => ServiceFabricConfigProvider.Configure(null)); }
public void SimpleConfiguration_SetCustomPackageNameAndSection_ProviderIsConfigured() { Should.NotThrow(() => ServiceFabricConfigProvider.Configure("Testconfig", "Toggles")); }
public void SimpleConfiguration_ConfigSectionNameIsNull_ThrowsArgumentException() { Should.Throw <ArgumentException>(() => ServiceFabricConfigProvider.Configure("Testconfig", null)); }
public void SimpleConfiguration_ConfigPackageNameIsNull_ThrowsArgumentException() { Should.Throw <ArgumentException>(() => ServiceFabricConfigProvider.Configure(null, "Toggles")); }
public void Setup() { ServiceFabricConfigProvider.Configure(usePrefix: false); }
public void BaseSetup() { ServiceFabricConfigProvider.Configure(new ServiceFabricConfiguration()); ServiceFabricConfigProvider.SetCodePackageActivationContextFactory(TestConfig.CreateMockCodePackageActivationContext); }
protected ServiceFabricToggle() { ToggleValueProvider = new ServiceFabricConfigProvider(); }