public async Task throw_if_store_provider_is_null() { var provider = new DelegatedEnvironmentNameProviderService(() => string.Empty); await Assert.ThrowsAsync <ArgumentNullException>(async() => { await new EnvironmentToggle(provider, null).IsActiveAsync(Constants.FeatureName, Constants.ProductName); }); }
public async Task be_active_if_current_environment_is_configured() { var toggle = Build .Toggle <EnvironmentToggle>() .AddOneParameter(Environments, Development) .Build(); var feature = Build .Feature(Constants.FeatureName) .AddOne(toggle) .Build(); var store = new DelegatedValueFeatureStore((_, __) => feature); var environmentNameProvider = new DelegatedEnvironmentNameProviderService(() => "development"); var active = await new EnvironmentToggle(environmentNameProvider, store).IsActiveAsync(Constants.FeatureName, Constants.ProductName); active.Should().BeTrue(); }
public async Task be_not_active_if_parameter_value_is_null() { var toggle = Build .Toggle <EnvironmentToggle>() .AddOneParameter("Environments", "Production") .Build(); var feature = Build .Feature(Constants.FeatureName) .AddOne(toggle) .Build(); var store = new DelegatedValueFeatureStore((_, __) => feature); var environmentNameProvider = new DelegatedEnvironmentNameProviderService(() => Development); var active = await new EnvironmentToggle(environmentNameProvider, store).IsActiveAsync(Constants.FeatureName, Constants.ProductName); active.Should().BeFalse(); }