public InGroupConditionTests() { _query = Substitute.For <IToggleContext>(); Sut.GroupName = "group"; Sut.SearchKey = "term"; }
public async Task <bool> IsActive(Guid toggleID, IToggleContext context) { var toggles = await _fetcher.GetAllToggles(); if (toggles.TryGetValue(toggleID, out var toggle) == false) { throw new ToggleNotFoundException(toggleID); } return(toggle.IsActive(_writer, context)); }
public bool IsActive(IStatisticsWriter writer, IToggleContext context) { var stats = new Statistic { ToggleID = ID, Timestamp = DateTime.Now, User = context.GetCurrentUser() }; var isActive = ConditionMode == ConditionModes.Any ? Conditions.Any(c => c.IsMatch(stats, context)) : Conditions.All(c => c.IsMatch(stats, context)); stats.Active = isActive; writer.Write(stats); return(isActive); }
public override bool IsMatch(Statistic stats, IToggleContext context) { return(Report(stats, context.GroupContains(GroupName, SearchKey))); }
public override bool IsMatch(Statistic stats, IToggleContext context) { return(Report(stats, Children.All(child => child.IsMatch(stats, context)))); }
public override bool IsMatch(Statistic stats, IToggleContext context) { return(Report(stats, Children.Single().IsMatch(stats, context) == false)); }
public override bool IsMatch(Statistic stats, IToggleContext context) { return(Report(stats, false)); }
public abstract bool IsMatch(Statistic stats, IToggleContext context);