// Calls LdClient.Init, but then sets LdClient.Instance to null so other tests can // instantiate their own independent clients. Application code cannot do this because // the LdClient.Instance setter has internal scope. public static LdClient CreateClient(Configuration config, User user, TimeSpan?timeout = null) { return(WithClientLock(() => { ClearClient(); LdClient client = LdClient.Init(config, user, timeout ?? TimeSpan.FromSeconds(1)); client.DetachInstance(); return client; })); }
// Calls LdClient.Init, but then sets LdClient.Instance to null so other tests can // instantiate their own independent clients. Application code cannot do this because // the LdClient.Instance setter has internal scope. public static async Task <LdClient> CreateClientAsync(Configuration config, User user) { return(await WithClientLockAsync(async() => { ClearClient(); LdClient client = await LdClient.InitAsync(config, user); client.DetachInstance(); return client; })); }