示例#1
0
        private static int RunMixedPackTest(ITestClient testClient, int loopSize, string key1, string key2, bool flushdb = true)
        {
            using (testClient)
            {
                var payload = Payloads.MediumPayload;
                testClient.Connect(_cs);
                if (flushdb)
                {
                    testClient.FlushDb();
                }
                var sw = new Stopwatch();
                sw.Start();

                for (var i = 0; i < loopSize; i++)
                {
                    testClient.SetAsync(key1, payload);
                    testClient.IncrAsync(key2);
                }

                var result     = testClient.GetString(key1);
                var incrResult = testClient.GetInt(key2);

                if (result != payload)
                {
                    Console.Write("[condition failed Result == Payload] ");
                }
                if (incrResult != loopSize)
                {
                    Console.Write("[condition failed IncrResult == LoopSize] ");
                }

                sw.Stop();
                return((int)sw.ElapsedMilliseconds);
            }
        }
示例#2
0
        private static int RunMixedPackTest(ITestClient testClient, int loopSize, string key1, string key2, bool flushdb = true)
        {
            using (testClient)
            {
                var payload = Payloads.MediumPayload;
                testClient.Connect(_cs);
                if (flushdb)
                    testClient.FlushDb();
                var sw = new Stopwatch();
                sw.Start();

                for (var i = 0; i < loopSize; i++)
                {
                    testClient.SetAsync(key1, payload);
                    testClient.IncrAsync(key2);
                }

                var result = testClient.GetString(key1);
                var incrResult = testClient.GetInt(key2);

                if (result != payload)
                    Console.Write("[condition failed Result == Payload] ");
                if (incrResult != loopSize)
                    Console.Write("[condition failed IncrResult == LoopSize] ");

                sw.Stop();
                return (int) sw.ElapsedMilliseconds;
            }
        }