public void Should_always_be_false() { // Arrange var strategy = new FlexibleRolloutStrategy(); // Assert strategy.IsEnabled(new Dictionary <string, string>(), new UnleashContext()).Should().BeFalse(); }
public void Should_have_correct_name() { // Arrange var strategy = new FlexibleRolloutStrategy(); // Assert strategy.Name.Should().Be("flexibleRollout"); }
public void Should_be_disabled_when_userId_is_missing() { // Arrange var strategy = new FlexibleRolloutStrategy(); var parameters = new Dictionary <string, string> { { "rollout", "100" }, { "stickiness", "userId" }, { "groupId", "Demo" } }; var context = new UnleashContext(); // Act var enabled = strategy.IsEnabled(parameters, context); // Assert enabled.Should().BeFalse(); }
public void Should_not_be_enabled_for_rollout_10_and_random_value_1() { // Arrange var strategy = new FlexibleRolloutStrategy(() => "1"); var parameters = new Dictionary <string, string> { { "rollout", "10" }, { "stickiness", "default" }, { "groupId", "Demo" } }; var context = new UnleashContext(); // Act var enabled = strategy.IsEnabled(parameters, context); // Assert enabled.Should().BeFalse(); }
public void Should_not_be_enabled_for_rollout_50_and_custom_stickiness_customField_no_value() { // Arrange var strategy = new FlexibleRolloutStrategy(); var parameters = new Dictionary <string, string> { { "rollout", "50" }, { "stickiness", "customField" }, { "groupId", "Feature.flexible.rollout.custom.stickiness_50" } }; var context = new UnleashContext(); // Act var enabled = strategy.IsEnabled(parameters, context); // Assert enabled.Should().BeFalse(); }
public void Should_be_enabled_for_rollout_10_and_userId_61_and_stickiness_userId() { // Arrange var strategy = new FlexibleRolloutStrategy(); var parameters = new Dictionary <string, string> { { "rollout", "10" }, { "stickiness", "userId" }, { "groupId", "Demo" } }; var context = new UnleashContext { UserId = "61" }; // Act var enabled = strategy.IsEnabled(parameters, context); // Assert enabled.Should().BeTrue(); }