public void BeginSend_MultipleRequests_AllRecognized(int expected) { int port = Ports.GetNext(); using (DicomServer.Create<DicomCEchoProvider>(port)) { var actual = 0; var client = new DicomClient(); client.NegotiateAsyncOps(expected, 1); for (var i = 0; i < expected; ++i) client.AddRequest(new DicomCEchoRequest { OnResponseReceived = (req, res) => ++actual }); client.EndSend(client.BeginSend("127.0.0.1", port, false, "SCU", "ANY-SCP", null, null)); Assert.Equal(expected, actual); } }
public void BeginSend_SingleRequest_Recognized() { int port = Ports.GetNext(); using (DicomServer.Create<DicomCEchoProvider>(port)) { var counter = 0; var request = new DicomCEchoRequest { OnResponseReceived = (req, res) => ++counter }; var client = new DicomClient(); client.AddRequest(request); client.EndSend(client.BeginSend("127.0.0.1", port, false, "SCU", "ANY-SCP", null, null)); Assert.Equal(1, counter); } }
public void BeginSend_SingleRequest_Recognized() { int port = Ports.GetNext(); using (DicomServer.Create <DicomCEchoProvider>(port)) { var counter = 0; var request = new DicomCEchoRequest { OnResponseReceived = (req, res) => Interlocked.Increment(ref counter) }; var client = new DicomClient(); client.AddRequest(request); client.EndSend(client.BeginSend("127.0.0.1", port, false, "SCU", "ANY-SCP", null, null)); Assert.Equal(1, counter); } }
public void BeginSend_MultipleRequests_AllRecognized(int expected) { int port = Ports.GetNext(); using (new DicomServer <DicomCEchoProvider>(port)) { var actual = 0; var client = new DicomClient(); for (var i = 0; i < expected; ++i) { client.AddRequest(new DicomCEchoRequest { OnResponseReceived = (req, res) => ++ actual }); } client.EndSend(client.BeginSend("127.0.0.1", port, false, "SCU", "ANY-SCP", null, null)); Assert.Equal(expected, actual); } }