Exemplo n.º 1
0
 /// <summary>
 /// Configure default <see cref="OnErrorBehavior"/> to used when feature evaluation throw an exception. Default value is SetDisabled.
 /// </summary>
 /// <param name="onErrorBehavior">The <see cref="OnErrorBehavior"/> to configure as default.</param>
 /// <returns>The same configuration to be chained.</returns>
 public EsquioOptions ConfigureOnErrorBehavior(OnErrorBehavior onErrorBehavior)
 {
     OnErrorBehavior = onErrorBehavior;
     return(this);
 }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }