public async Task Cleanup()
        {
            try
            {
                var dut = new AsyncRedisClient();
                await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

                await dut.Select(0);

                await dut.Del(Key);

                await dut.Del(Key2);

                await dut.Select(7);

                await dut.Del(Key);

                await dut.Del(Key2);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error during cleanup: {ex}");
                throw;
            }
        }
예제 #2
0
        public async Task Cleanup()
        {
            var dut = new AsyncRedisClient();

            await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

            await dut.Del(ListKey);
        }
예제 #3
0
        public static void Main()
        {
            var client             = new AsyncRedisClient();
            var connectionSettings = new ConnectionSettings("127.0.0.1", 6379);

            FailIfException(async() =>
            {
                Console.WriteLine($"Trying to connect to {connectionSettings.Address}:{connectionSettings.Port}...");
                await client.Connect(connectionSettings);
                Pass();
            }).GetAwaiter().GetResult();

            FailIfException(async() =>
            {
                Console.WriteLine("Trying simple write...");
                await client.Set(Key, Value);
                Pass();
            }).GetAwaiter().GetResult();

            FailIfException(async() =>
            {
                Console.WriteLine("Trying simple read...");
                var result = await client.Get(Key);
                if (result == Value)
                {
                    Pass();
                }
                else
                {
                    Fail("Read incorrect value from the server");
                }
            }).GetAwaiter().GetResult();

            FailIfException(async() =>
            {
                Console.WriteLine("Trying DbSize...");
                var result = await client.DbSize();

                if (result == 1)
                {
                    Pass();
                }
                else
                {
                    Fail("Read incorrect db size from the server");
                }
            }).GetAwaiter().GetResult();

            FailIfException(async() =>
            {
                Console.WriteLine("Trying delete...");
                await client.Del(Key);
                Pass();
            }).GetAwaiter().GetResult();
        }
예제 #4
0
        public async Task Cleanup()
        {
            try
            {
                var dut = new AsyncRedisClient();
                await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

                await dut.Select(0);

                _keys.ForEach(k => dut.Del(k).GetAwaiter().GetResult());
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error during cleanup: {ex}");
                throw;
            }
        }