コード例 #1
0
        public async Task CanSaveAndLoadValue()
        {
            var text = DateTime.Now.ToString("O");

            await _client.Save("/test", text);

            var loadedValue = await _client.Load("/test");

            Console.WriteLine(loadedValue);

            Assert.That(loadedValue, Is.EqualTo(text));
        }
コード例 #2
0
        internal void Initialize(EtcdClient client, ITransport transport)
        {
            var address = transport.Address;
            var done    = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem(async _ =>
            {
                await Task.WhenAll(_ownedCommandTypes.Select(async type =>
                {
                    var typeName = _typeHelper.GetName(type);
                    await client.Save(typeName, address);
                }));

                done.Set();
            });

            done.WaitOne();
        }