public void Test_Poke() { using var server = new TestServer(ServiceName); server.Register(); using var client = new DdeClient(ServiceName, TopicName); client.Connect(); client.Poke(ItemName, Encoding.ASCII.GetBytes(TestData), 1, Timeout); Assert.AreEqual(TestData, Encoding.ASCII.GetString(server.GetData(TopicName, ItemName, 1))); }
public void Test_EndPoke() { using var server = new TestServer(ServiceName); server.Register(); using var client = new DdeClient(ServiceName, TopicName); client.Connect(); var ar = client.BeginPoke(ItemName, Encoding.ASCII.GetBytes(TestData), 1, null, null); Assert.IsTrue(ar.AsyncWaitHandle.WaitOne(Timeout, false)); client.EndPoke(ar); Assert.AreEqual(TestData, Encoding.ASCII.GetString(server.GetData(TopicName, ItemName, 1))); }
public void Test_TryPoke_Variation_2() { using (TestServer server = new TestServer(ServiceName)) { server.Register(); using (DdeClient client = new DdeClient(ServiceName, TopicName)) { client.Connect(); int result = client.TryPoke(ItemName, Encoding.ASCII.GetBytes(TestData), 1, Timeout); Assert.AreEqual(0, result); Assert.AreEqual(TestData, Encoding.ASCII.GetString(server.GetData(TopicName, ItemName, 1))); } } }
public void Test_Poke() { using (TestServer server = new TestServer(ServiceName)) { server.Register(); using (DdeClient client = new DdeClient(ServiceName, TopicName)) { client.Connect(); client.Poke(ItemName, Encoding.ASCII.GetBytes(TestData), 1, Timeout); Assert.AreEqual(TestData, Encoding.ASCII.GetString(server.GetData(TopicName, ItemName, 1))); } } }
public void Test_EndPoke() { using (TestServer server = new TestServer(ServiceName)) { server.Register(); using (DdeClient client = new DdeClient(ServiceName, TopicName)) { client.Connect(); IAsyncResult ar = client.BeginPoke(ItemName, Encoding.ASCII.GetBytes(TestData), 1, null, null); Assert.IsTrue(ar.AsyncWaitHandle.WaitOne(Timeout, false)); client.EndPoke(ar); Assert.AreEqual(TestData, Encoding.ASCII.GetString(server.GetData(TopicName, ItemName, 1))); } } }