Ejemplo n.º 1
0
        public void use_descriptor_with_activator_name_equals_to_activator_type_name()
        {
            var activator = new RolloutUserNameActivatorBuilder()
                            .WithActiveUsers(new string[] { "user1" })
                            .WithRuntimeParameters(new Dictionary <string, object>()
            {
                { "percentage", 0d }
            })
                            .Build();

            var typeName = typeof(RolloutUsernameActivator).Name;

            activator.Descriptors
            .ToList()
            .ForEach(d => d.ActivatorName.Should().BeEquivalentTo(typeName));
        }
Ejemplo n.º 2
0
        public async Task be_not_active_when_percentage_is_0()
        {
            var activator = new RolloutUserNameActivatorBuilder()
                            .WithRuntimeParameters(new Dictionary <string, object>()
            {
                { "percentage", 0d }
            })
                            .WithActiveUsers(new string[] { "user1" })
                            .Build();

            int index = 0;

            while (index < 100)
            {
                (await activator.IsActiveAsync("feature")).Should().Be(false);

                ++index;
            }
        }
Ejemplo n.º 3
0
        public async Task indicates_whether_activator_is_active()
        {
            var activator = new RolloutUserNameActivatorBuilder()
                            .WithRuntimeParameters(new Dictionary <string, object>()
            {
                { "percentage", 50d }
            })
                            .WithActiveUsers(new string[] { "user_selected_to_be_on_first_part" })
                            .Build();

            int index = 0;

            while (index < 100)
            {
                (await activator.IsActiveAsync("feature")).Should().Be(true);

                ++index;
            }
        }