public void ExceptionWhenGettingOneFlagIsHandledCorrectly()
        {
            // If the data store's Get method throws an error, the expected behavior is that we log
            // a message and return the default value. The exception should not propagate to the caller.
            var ex        = new Exception("fake-error");
            var flagKey   = "flag-key";
            var mockStore = new Mock <IDataStore>();

            mockStore.Setup(s => s.Get(DataModel.Features, flagKey)).Throws(ex);
            var configWithCustomStore = Configuration.Builder("sdk-key")
                                        .DataStore(new SpecificDataStoreFactory(mockStore.Object))
                                        .DataSource(Components.ExternalUpdatesOnly)
                                        .Logging(testLogging)
                                        .Build();

            using (var clientWithCustomStore = new LdClient(configWithCustomStore))
            {
                var defaultValue = "default-value";
                var result       = clientWithCustomStore.StringVariationDetail("flag-key", user, defaultValue);
                Assert.Equal(defaultValue, result.Value);
                Assert.Null(result.VariationIndex);
                Assert.Equal(EvaluationReason.ErrorReason(EvaluationErrorKind.Exception), result.Reason);
                Assert.True(logCapture.HasMessageWithRegex(Logging.LogLevel.Error, ex.Message));
            }
        }
        public void ExceptionWhenGettingOneFlagIsHandledCorrectly()
        {
            // If the data store's Get method throws an error, the expected behavior is that we log
            // a message and return the default value. The exception should not propagate to the caller.
            var ex        = new Exception("fake-error");
            var flagKey   = "flag-key";
            var mockStore = new Mock <IDataStore>();

            mockStore.Setup(s => s.Get(DataModel.Features, flagKey)).Throws(ex);
            var configWithCustomStore = BasicConfig()
                                        .DataStore(mockStore.Object.AsSingletonFactory())
                                        .Build();

            using (var clientWithCustomStore = new LdClient(configWithCustomStore))
            {
                var defaultValue = "default-value";
                var result       = clientWithCustomStore.StringVariationDetail("flag-key", user, defaultValue);
                Assert.Equal(defaultValue, result.Value);
                Assert.Null(result.VariationIndex);
                Assert.Equal(EvaluationReason.ErrorReason(EvaluationErrorKind.Exception), result.Reason);
                AssertLogMessageRegex(true, Logging.LogLevel.Error, ex.Message);
            }
        }