public async Task be_not_active_when_claim_type_and_value_are_successfully_configured() { var toggle = Build .Toggle <ClaimValueToggle>() .AddParameter("ClaimType", "some_claim_type") .AddParameter("ClaimValues", "some_claim_value") .Build(); var feature = Build .Feature(Constants.FeatureName) .AddOne(toggle) .Build(); var context = new DefaultHttpContext(); context.User = new ClaimsPrincipal( new ClaimsIdentity(new Claim[] { new Claim("some_claim_type", "not_some_claim_value") }, "cookies")); var store = new DelegatedValueFeatureStore((_, __, ___) => feature); var claimValueToggle = new ClaimValueToggle(new FakeHttpContextAccessor(context)); var active = await claimValueToggle.IsActiveAsync( ToggleExecutionContext.FromToggle( feature.Name, EsquioConstants.DEFAULT_PRODUCT_NAME, EsquioConstants.DEFAULT_DEPLOYMENT_NAME, toggle)); active.Should() .BeFalse(); }
public async Task be_active_when_claim_type_and_value_are_successfully_configured() { var toggle = Build .Toggle <ClaimValueToggle>() .AddOneParameter("ClaimType", "some_claim_type") .AddOneParameter("ClaimValues", "some_claim_value") .Build(); var feature = Build .Feature(Constants.FeatureName) .AddOne(toggle) .Build(); var context = new DefaultHttpContext(); context.User = new ClaimsPrincipal( new ClaimsIdentity(new Claim[] { new Claim("some_claim_type", "some_claim_value") }, "cookies")); var store = new DelegatedValueFeatureStore((_, __) => feature); var claimValueToggle = new ClaimValueToggle(store, new FakeHttpContextAccesor(context)); var active = await claimValueToggle.IsActiveAsync(Constants.FeatureName); active.Should() .BeTrue(); }