public void ConnectTest() { ISocketEventClient client; client = SocketEventClientFactory.CreateInstance(URL); Assert.IsNotNull(client); }
public void SubscribeTest() { ISocketEventClient client; client = SocketEventClientFactory.CreateInstance("MerchantServiceClient", URL); string eventName = "TestEvent"; ISocketEventResponse serverResponse = null; ISocketEventRequest serverRequest = null; Semaphore s = new Semaphore(0, 1); client.Subscribe(eventName, new Func <ISocketEventRequest, RequestResult>((request) => { serverRequest = request; s.Release(); return(RequestResult.Success); }), (response) => { serverResponse = response; }); client.Enqueue(eventName); s.WaitOne(); Assert.AreEqual(RequestResult.Success, serverResponse.Status); Assert.AreEqual(eventName, serverRequest.EventName); Assert.IsNotNull(serverRequest.RequestId); }
public void EnqueueTest() { ISocketEventClient client; client = SocketEventClientFactory.CreateInstance(URL); string eventName = "TestEvent"; ISocketEventResponse response = null; Semaphore s = new Semaphore(0, 1); client.Enqueue(eventName, (data) => { response = data; s.Release(); }); s.WaitOne(3000); Assert.AreEqual(RequestResult.Success, response.Status); }