Ejemplo n.º 1
0
        public static void TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                try
                {
                    cl.Sleeper(5000);
                }
                catch (ClientCallException err)
                {
                    Aver.IsTrue(CallStatus.Timeout == err.Status);
                    return;
                }
                catch (System.IO.IOException err) //sync binding throws IO exception
                {
                    Aver.IsTrue(err.Message.Contains("after a period of time"));
                    return;
                }

                Aver.Fail("Invalid Call status");
            }
        }
Ejemplo n.º 2
0
        public static void TASK_TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                System.Threading.Tasks.Task <CallSlot> task = null;
                try
                {
                    task = cl.Async_Sleeper(10000).AsTask;
                    task.Result.GetValue <int>();
                }
                catch (ClientCallException err)
                {
                    Aver.IsTrue(CallStatus.Timeout == err.Status);
                    return;
                }
                catch (System.IO.IOException err) //sync binding throws IO exception
                {
                    Aver.IsTrue(err.Message.Contains("after a period of time"));
                    return;
                }

                Aver.Fail("Invalid Call status: " + (task != null ? task.Result.CallStatus.ToString() : "task==null"));
            }
        }
Ejemplo n.º 3
0
        public static void TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

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

                var result = cl.Method1(12);
                Aver.AreEqual("12", result);
                Aver.AreEqual(12, TestServerA.s_Accumulator);
            }
        }
Ejemplo n.º 4
0
        public static void TestContractA_OneWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

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

                cl.Method2(93);

                for (var cnt = 0; cnt < 10 && TestServerA.s_Accumulator != 93; cnt++)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                Aver.AreEqual(93, TestServerA.s_Accumulator);
            }
        }