public async Task be_not_active_when_headervalue__are_not_successfully_configured()
        {
            var toggle = Build
                         .Toggle <HeaderValueToggle>()
                         .AddOneParameter("HeaderName", "Accept")
                         .AddOneParameter("HeaderValues", "text/xml")
                         .Build();

            var feature = Build
                          .Feature(Constants.FeatureName)
                          .AddOne(toggle)
                          .Build();

            var context = new DefaultHttpContext();

            context.Request.Headers.Add("Accept", "application/json");

            var store             = new DelegatedValueFeatureStore((_, __) => feature);
            var headerValueToggle = new HeaderValueToggle(store, new FakeHttpContextAccesor(context));

            var active = await headerValueToggle.IsActiveAsync(Constants.FeatureName);

            active.Should()
            .BeFalse();
        }
Example #2
0
        public async Task be_not_active_when_headervalue__are_not_successfully_configured()
        {
            var toggle = Build
                         .Toggle <HeaderValueToggle>()
                         .AddParameter("HeaderName", "Accept")
                         .AddParameter("HeaderValues", "text/xml")
                         .Build();

            var feature = Build
                          .Feature(Constants.FeatureName)
                          .AddOne(toggle)
                          .Build();

            var context = new DefaultHttpContext();

            context.Request.Headers.Add("Accept", "application/json");

            var headerValueToggle = new HeaderValueToggle(new FakeHttpContextAccessor(context));

            var active = await headerValueToggle.IsActiveAsync(
                ToggleExecutionContext.FromToggle(
                    feature.Name,
                    EsquioConstants.DEFAULT_PRODUCT_NAME,
                    EsquioConstants.DEFAULT_DEPLOYMENT_NAME,
                    toggle));

            active.Should()
            .BeFalse();
        }