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"); } }
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")); } }
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); } }
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); } }