Esempio n. 1
0
 public DefaultFeatureService(
     IRuntimeFeatureStore store,
     IToggleTypeActivator toggleActivator,
     IScopedEvaluationHolder session,
     IOptions <EsquioOptions> options,
     EsquioDiagnostics diagnostics)
 {
     _featureStore    = store ?? throw new ArgumentNullException(nameof(store));
     _toggleActivator = toggleActivator ?? throw new ArgumentNullException(nameof(toggleActivator));
     _session         = session ?? throw new ArgumentNullException(nameof(session));
     _options         = options.Value ?? throw new ArgumentNullException(nameof(options));
     _diagnostics     = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));
 }
Esempio n. 2
0
        private IFeatureService CreateFeatureService(List <Feature> configuredFeatures, IScopedEvaluationHolder evaluationSession = null, OnErrorBehavior onErrorBehavior = OnErrorBehavior.SetDisabled, NotFoundBehavior notFoundBehavior = NotFoundBehavior.SetDisabled)
        {
            var store     = new FakeRuntimeStore(configuredFeatures);
            var activator = new FakeToggleActivator();
            var session   = evaluationSession ?? new NoScopedEvaluationHolder();

            var esquioOptions = new EsquioOptions();

            esquioOptions.ConfigureOnErrorBehavior(onErrorBehavior);
            esquioOptions.ConfigureNotFoundBehavior(notFoundBehavior);

            var options       = Options.Create <EsquioOptions>(esquioOptions);
            var loggerFactory = new LoggerFactory();

            var esquioDiagnostics = new EsquioDiagnostics(loggerFactory);

            return(new DefaultFeatureService(store, activator, session, options, esquioDiagnostics));
        }