public void Can_failover_MqServer_at_runtime()
        {
            const int iterations = 100;
            var failoverHost = "redis-failover:6379";
            var localClient = new RedisClient("localhost:6379");

            localClient.FlushDb();
            var failoverClient = new RedisClient(failoverHost);
            failoverClient.FlushDb();

            var clientManager = new PooledRedisClientManager(new[] { "localhost" });
            var mqHost = new RedisMqServer(clientManager);

            var map = new Dictionary<string, int>();
            var received = 0;
            mqHost.RegisterHandler<Msg>(c =>
            {
                var dto = c.GetBody();
                received++;
                int count;
                map.TryGetValue(dto.Host, out count);
                map[dto.Host] = count + 1;

                lock (clientManager)
                {
                    "Received #{0} from {1}".Print(received, dto.Host);
                    if (received == iterations)
                        Monitor.Pulse(clientManager);
                }

                return null;
            });

            mqHost.Start();

            RunMqInLoop(mqHost, iterations: iterations, callback: () =>
            {
                lock (clientManager)
                    "{0} msgs were published.".Print(iterations);
            });

            Thread.Sleep(500);

            clientManager.FailoverTo(failoverHost);

            lock (clientManager)
                Monitor.Wait(clientManager);

            map.PrintDump();
            "localclient inq: {0}, outq: {1}".Print(
                localClient.GetListCount("mq:Msg.inq"),
                localClient.GetListCount("mq:Msg.outq"));
            "failoverClient inq: {0}, outq: {1}".Print(
                failoverClient.GetListCount("mq:Msg.inq"),
                failoverClient.GetListCount("mq:Msg.outq"));

            Assert.That(received, Is.EqualTo(100));
            Assert.That(map.Count, Is.EqualTo(2));
            var msgsFromAllHosts = 0;
            foreach (var count in map.Values)
            {
                Assert.That(count, Is.GreaterThan(0));
                msgsFromAllHosts += count;
            }
            Assert.That(msgsFromAllHosts, Is.EqualTo(iterations));
        }
	    public void Can_call_Type_in_transaction()
	    {
	        Redis.SetValue("string", "STRING");
	        Redis.AddItemToList("list", "LIST");
	        Redis.AddItemToSet("set", "SET");
	        Redis.AddItemToSortedSet("zset", "ZSET", 1);

	        var keys = new[] { "string", "list", "set", "zset" };

            var results = new Dictionary<string, string>();
            using (var trans = Redis.CreateTransaction())
            {
                foreach (var key in keys)
                {
                    trans.QueueCommand(r => r.Type(key), x => results[key] = x);
                }

                trans.Commit();
            }

            results.PrintDump();

            Assert.That(results, Is.EquivalentTo(new Dictionary<string,string>
            {
                {"string", "string" },
                {"list", "list" },
                {"set", "set" },
                {"zset", "zset" },
            }));
        }