Exemple #1
0
        public static async Task ASYNC_MANY_AWAITS_TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new AzosApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(app.Glue, app.ConfigRoot.AttrByName("cs").Value);

                var call = cl.Async_Method1(234);

                var result = await call.AsTaskReturning <string>();

                Aver.IsTrue(call.Available);

                Aver.AreEqual("234", result);

                Aver.AreEqual("234", (await call).GetValue <string>()); //this will instantly return as it is completed already
                Aver.AreEqual("234", (await call).GetValue <string>()); //so will this
                Aver.AreEqual("234", (await call).GetValue <string>()); //and this... and so on.... can do many awaits

                Aver.AreEqual(234, TestServerA.s_Accumulator);
            }
        }
Exemple #2
0
        public static void TASKReturning_TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new AzosApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(app.Glue, app.ConfigRoot.AttrByName("cs").Value);

                var call = cl.Async_Method1(12);
                var task = call.AsTaskReturning <string>();

                var result = task.Result;

                Aver.AreEqual("12", result);
                Aver.AreEqual(12, TestServerA.s_Accumulator);
            }
        }
Exemple #3
0
        public static async Task ASYNC_AWAIT_CALL_TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new AzosApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(app.Glue, app.ConfigRoot.AttrByName("cs").Value);

                var call = cl.Async_Method1(12);

                await call;//this will wait and come back on either timeout or result delivery

                Aver.IsTrue(call.Available);

                Aver.AreEqual("12", call.GetValue <string>());
                Aver.AreEqual(12, TestServerA.s_Accumulator);
            }
        }