Example #1
0
        public async Task be_inactive_when_ip_address_is_in_the_ip_addresses_list()
        {
            var toggle = Build
                         .Toggle <ClientIpAddressToggle>()
                         .AddOneParameter(nameof(ClientIpAddressToggle.IpAddresses), "134.24.21.35;134.24.21.36")
                         .Build();

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

            var store = new StubRuntimeFeatureStore((_, __) => feature);

            var isActive = await new ClientIpAddressToggle(
                store,
                new StubtHttpContextAccessor(),
                NullLogger <ClientIpAddressToggle> .Instance)
                           .IsActiveAsync(FeatureName);

            isActive.Should().BeFalse();
        }
Example #2
0
        public async Task be_inactive_when_hostname_is_not_in_the_hostnames_list()
        {
            var toggle = Build
                         .Toggle <HostNameToggle>()
                         .AddOneParameter(nameof(HostNameToggle.HostNames), "domain.it;domain.com")
                         .Build();

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

            var store = new StubRuntimeFeatureStore((_, __) => feature);

            var isActive = await new HostNameToggle(
                store,
                new StubtHttpContextAccessor(),
                NullLogger <HostNameToggle> .Instance)
                           .IsActiveAsync(FeatureName);

            isActive.Should().BeFalse();
        }