public LdClientBigSegmentsTest(ITestOutputHelper testOutput) : base(testOutput) { _testData = TestData.DataSource(); _user = User.WithKey("userkey"); _bigSegment = new SegmentBuilder("segmentkey") .Unbounded(true) .Generation(1) .Build(); _flag = new FeatureFlagBuilder("flagkey") .On(true) .Variations(LdValue.Of(false), LdValue.Of(true)) .FallthroughVariation(0) .Rules( new RuleBuilder().Variation(1).Clauses( ClauseBuilder.ShouldMatchSegment(_bigSegment.Key) ).Build() ) .Build(); _testData.UsePreconfiguredFlag(_flag); _testData.UsePreconfiguredSegment(_bigSegment); _storeMock = new MockBigSegmentStore(); _storeFactory = _storeMock.AsSingletonFactory(); _storeMock.SetupMetadataReturns(new StoreMetadata { LastUpToDate = UnixMillisecondTime.Now }); }
public BigSegmentsConfigurationBuilderTest(ITestOutputHelper testOutput) : base(testOutput) { var storeMock = new Mock <IBigSegmentStore>(); _store = storeMock.Object; var storeFactoryMock = new Mock <IBigSegmentStoreFactory>(); _storeFactory = storeFactoryMock.Object; storeFactoryMock.Setup(f => f.CreateBigSegmentStore(BasicContext)).Returns(_store); _tester = BuilderBehavior.For(() => Components.BigSegments(_storeFactory)); }
public BigSegmentsStoreWrapperTest(ITestOutputHelper testOutput) : base(testOutput) { _store = new MockBigSegmentStore(); _storeFactory = _store.AsSingletonFactory(); }
internal BigSegmentsConfigurationBuilder(IBigSegmentStoreFactory storeFactory) { _storeFactory = storeFactory; }
/// <summary> /// Returns a configuration builder for the SDK's Big Segments feature. /// </summary> /// <remarks> /// <para> /// "Big Segments" are a specific type of user segments. For more information, read the LaunchDarkly /// documentation about user segments: https://docs.launchdarkly.com/home/users/segments /// </para> /// <para> /// After configuring this object, use <see cref="ConfigurationBuilder.BigSegments(IBigSegmentsConfigurationFactory)"/> /// to store it in your SDK configuration. For example, using the Redis integration: /// </para> /// <code> /// var config = Configuration.Builder(sdkKey) /// .BigSegments(Components.BigSegments(Redis.DataStore().Prefix("app1")) /// .UserCacheSize(2000)) /// .Build(); /// </code> /// <para> /// You must always specify the <paramref name="storeFactory"/> parameter, to tell the SDK what database /// you are using. Several database integrations exist for the LaunchDarkly SDK, each with its own /// behavior and options specific to that database; this is described via some implementation of /// <see cref="IBigSegmentStoreFactory"/>. The <see cref="BigSegmentsConfigurationBuilder"/> adds /// configuration options for aspects of SDK behavior that are independent of the database. In the /// example above, <code>Prefix</code> is an option specifically for the Redis integration, whereas /// <code>UserCacheSize</code> is an option that can be used for any data store type. /// </para> /// </remarks> /// <param name="storeFactory">the factory for the underlying data store</param> /// <returns>a <see cref="BigSegmentsConfigurationBuilder"/></returns> public static BigSegmentsConfigurationBuilder BigSegments(IBigSegmentStoreFactory storeFactory) => new BigSegmentsConfigurationBuilder(storeFactory);