public void OldCStoreRequestSend_16BitJpegFileToScpThatDoesNotSupportJpeg_TransferSuccessfulImplicitLENoPixelData() { const string file = @"Test Data/GH538-jpeg14sv1.dcm"; var handle = new ManualResetEventSlim(); var success = false; var port = Ports.GetNext(); using (DicomServer.Create <VideoCStoreProvider>(port)) { var request = new DicomCStoreRequest(file); request.OnResponseReceived = (req, rsp) => { if (req.Dataset.InternalTransferSyntax.Equals(DicomTransferSyntax.ImplicitVRLittleEndian) && !req.Dataset.Contains(DicomTag.PixelData) && rsp.Status == DicomStatus.Success) { success = true; } handle.Set(); }; var client = new Network.DicomClient(); client.AddRequest(request); client.Send("localhost", port, false, "STORESCU", "STORESCP"); handle.Wait(10000); Assert.True(success); } }
public void OldCStoreRequestSend_VideoFileServerSupportsMPEG4_TransferSuccessful() { const string fileName = @"Test Data/test_720.dcm"; var success = false; var handle = new ManualResetEventSlim(); var port = Ports.GetNext(); using (DicomServer.Create <VideoCStoreProvider>(port)) { var request = new DicomCStoreRequest(fileName); request.OnResponseReceived = (req, rsp) => { success = req.Dataset.InternalTransferSyntax.Equals( DicomTransferSyntax.Lookup(DicomUID.MPEG4HP41)) && rsp.Status == DicomStatus.Success; handle.Set(); }; var client = new Network.DicomClient(); client.AddRequest(request); client.Send("localhost", port, false, "STORESCU", "STORESCP"); handle.Wait(10000); Assert.True(success); } }
public void OldCStoreRequestSend_8And16BitJpegFiles_TransferSuccessful() { const string file1 = @"Test Data/GH538-jpeg1.dcm"; const string file2 = @"Test Data/GH538-jpeg14sv1.dcm"; var handle1 = new ManualResetEventSlim(); var handle2 = new ManualResetEventSlim(); var successes = 0; var port = Ports.GetNext(); using (DicomServer.Create <SimpleCStoreProvider>(port)) { var request1 = new DicomCStoreRequest(file1); request1.OnResponseReceived = (req, rsp) => { if (req.Dataset.InternalTransferSyntax.Equals(DicomTransferSyntax.JPEGProcess1) && rsp.Status == DicomStatus.Success) { ++successes; } handle1.Set(); }; var request2 = new DicomCStoreRequest(file2); request2.OnResponseReceived = (req, rsp) => { if (req.Dataset.InternalTransferSyntax.Equals(DicomTransferSyntax.JPEGProcess14SV1) && rsp.Status == DicomStatus.Success) { ++successes; } handle2.Set(); }; var client = new Network.DicomClient(); client.AddRequest(request1); client.AddRequest(request2); client.Send("localhost", port, false, "STORESCU", "STORESCP"); handle1.Wait(10000); handle2.Wait(10000); Assert.Equal(2, successes); } }
public void Send_FromDicomClient_DoesNotDeadlock() { var port = Ports.GetNext(); using (var server = DicomServer.Create <DicomCEchoProvider>(port)) { server.Logger = new XUnitDicomLogger(_output).IncludeTimestamps().IncludeThreadId().IncludePrefix("DicomCEchoProvider"); var client = new Network.DicomClient { Logger = new XUnitDicomLogger(_output).IncludeTimestamps().IncludeThreadId().IncludePrefix("DicomClient") }; for (var i = 0; i < 10; i++) { client.AddRequest(new DicomCEchoRequest()); } client.Send("127.0.0.1", port, false, "SCU", "ANY-SCP"); Assert.False(client.IsSendRequired); } }
public void OldDicomClientSend_TooManyPresentationContexts_YieldsInformativeException() { var port = Ports.GetNext(); using (DicomServer.Create <DicomCEchoProvider>(port)) { var client = new Network.DicomClient(); // this just illustrates the issue of too many presentation contexts, not real world application. var pcs = DicomPresentationContext.GetScpRolePresentationContextsFromStorageUids( DicomStorageCategory.None, DicomTransferSyntax.ImplicitVRLittleEndian); client.AdditionalPresentationContexts.AddRange(pcs); var exception = Record.Exception(() => client.Send("localhost", port, false, "SCU", "SCP")); Assert.IsType <DicomNetworkException>(exception); } }