Example #1
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 <DefaultFeatureService>();

            return(new DefaultFeatureService(store, activator, options, logger));
        }
Example #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));
        }
        private IFeatureService CreateFeatureService(List <Feature> configuredFeatures, OnErrorBehavior onErrorBehavior = OnErrorBehavior.SetDisabled, NotFoundBehavior notFoundBehavior = NotFoundBehavior.SetDisabled)
        {
            var store     = new FakeRuntimeStore(configuredFeatures);
            var activator = new FakeToggleActivator();
            var observer  = new NoFeatureEvaluationObserver();

            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, observer, options, esquioDiagnostics));
        }