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

            var esquioOptions = new EsquioOptions();

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

            var options           = Options.Create <EsquioOptions>(esquioOptions);
            var loggerFactory     = new LoggerFactory();
            var logger            = loggerFactory.CreateLogger <global::Esquio.Diagnostics.Esquio>();
            var listener          = new DiagnosticListener("Esquio");
            var esquioDiagnostics = new EsquioDiagnostics(listener, logger);

            return(new DefaultFeatureService(store, activator, options, esquioDiagnostics));
        }
示例#3
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));
        }
 public DefaultToggleTypeActivator(IServiceProvider serviceProvider, EsquioDiagnostics diagnostics)
 {
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _diagnostics     = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));
 }