예제 #1
0
        /// <summary>
        /// 测试
        /// </summary>
        internal void Test()
        {
            dictionary.Clear();

            start(CallbackType.Asynchronous, TestType.BinarySetNodeCache);
            AutoCSer.CacheServer.DataStructure.Parameter.OperationBool setNode = dictionary.GetSetNode(count - 1, int.MaxValue - count);
            for (int index = count; index != 0;)
            {
                --index;
                setNode.Operation(setCallbackReturnParameter);
            }
            wait();

            start(CallbackType.Asynchronous, TestType.BinarySetValueCache);
            Binary <int> value = int.MaxValue - count;

            for (int index = count; index != 0; dictionary.Set(--index, value, setCallbackReturnParameter))
            {
                ;
            }
            wait();

            dictionary.Clear();

            start(CallbackType.Asynchronous, TestType.BinarySet);
            for (int index = count; index != 0;)
            {
                --index;
                dictionary.Set(index, count - index, setCallbackReturnParameter);
            }
            wait();

            start(CallbackType.Asynchronous, TestType.BinaryGetNodeCache);
            AutoCSer.CacheServer.DataStructure.Parameter.QueryReturnValue <Binary <int> > getNode = dictionary.GetNode(count - 1);
            for (int index = count; index != 0;)
            {
                --index;
                getNode.Query(getCallbackReturnParameter);
            }
            wait();

            start(CallbackType.Asynchronous, TestType.BinaryGet);
            for (int index = count; index != 0; dictionary.Get(--index, getCallbackReturnParameter))
            {
                ;
            }
            wait();

            dictionary.Clear();

            start(CallbackType.Synchronous, TestType.BinarySet);
            for (int index = count; index != 0;)
            {
                --index;
                setCallback(dictionary.Set(index, count - index));
            }
            wait();

            start(CallbackType.Synchronous, TestType.BinaryGet);
            for (int index = count; index != 0;)
            {
                --index;
                getCallback(dictionary.Get(index));
            }
            wait();

            dictionary.Clear();
        }