예제 #1
0
        private void TestActions()
        {
            Console.Write("  Actions\n");
            Debug.Assert(iDeviceList.Count == 1);
            CpProxyZappOrgTestBasic1 proxy = new CpProxyZappOrgTestBasic1(iDeviceList[0]);
            uint i;

            Console.Write("    Unsigned integer arguments...\n");
            uint valUint = 15;

            for (i = 0; i < kTestIterations; i++)
            {
                uint result;
                proxy.SyncIncrement(valUint, out result);
                Debug.Assert(result == valUint + 1);
                valUint = result;
            }

            Console.Write("    Integer arguments...\n");
            int valInt = 3;

            for (i = 0; i < kTestIterations; i++)
            {
                int result;
                proxy.SyncDecrement(valInt, out result);
                Debug.Assert(result == valInt - 1);
                valInt = result;
            }

            Console.Write("    Boolean arguments...\n");
            bool valBool = true;

            for (i = 0; i < kTestIterations; i++)
            {
                bool result;
                proxy.SyncToggle(valBool, out result);
                Debug.Assert(result == !valBool);
                valBool = result;
            }

            Console.Write("    String arguments...\n");
            string valStr = "<&'tag\">";

            for (i = 0; i < kTestIterations; i++)
            {
                string result;
                proxy.SyncEchoString(valStr, out result);
                Debug.Assert(result == valStr);
            }

            Console.Write("    Binary arguments...\n");
            char[] bin = new char[128];
            for (i = 0; i < 127; i++)
            {
                bin[i] = (char)(i + 1);
            }
            bin[127] = '\0';
            string valBin = new string(bin);

            for (i = 0; i < kTestIterations; i++)
            {
                string result;
                proxy.SyncEchoBinary(valStr, out result);
                Debug.Assert(result == valStr);
            }

            proxy.Dispose();
        }