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 void When_a_toggle_is_not_found_by_id() { _fetcher.GetAllToggles().Returns(new Dictionary <Guid, Toggle>()); Should.Throw <ToggleNotFoundException>(() => _service.IsActive(Guid.NewGuid(), null)); }