/// <summary>
        /// Returns number of responses.
        /// </summary>
        /// <param name="studyTime"></param>
        /// <param name="StydyTimeRange"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        private int Ticket788CommonCode2
            (String studyTime,
            String StydyTimeRange)
        {
            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            DicomFile dicomFile = new DicomFile();

            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");

            dicomFile.DataSet.Set("0x00080020", VR.DA, "20090225"); // Study date.
            dicomFile.DataSet.Set("0x00080030", VR.TM, studyTime);  // Study time.

            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            DicomMessage cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);

            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00100020", VR.LO, "1");                              // Patient ID.
            cFindRequest.DataSet.Set("0x0020000D", VR.UI);                                   // Study instance UID.
            cFindRequest.Set("0x00080030", VR.TM, StydyTimeRange);                           // Study time.
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "STUDY");                          // Query Retrieve Level.

            DicomMessageCollection cFindResponses = queryRetrievePatientRootInformationModel.QueryInformationModel(cFindRequest);

            return(cFindResponses.Count);
        }
        public void Ticket788_12_1()
        {
            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = null;
            DicomMessage cFindRequest = null;

            Ticket788CommonCode1(@"*\*", out queryRetrievePatientRootInformationModel, out cFindRequest);

            DicomMessageCollection dicomMessageCollection = queryRetrievePatientRootInformationModel.QueryInformationModel(cFindRequest);

            // Expect two messages with status pending and on message with status success.
            Assert.That(dicomMessageCollection.Count, Is.EqualTo(3));
        }
        public void Ticket1361_4_1()
        {
            DicomFile dicomFile = null;

            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile, false);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.2");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile, false);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.3");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile, false);

            DicomMessage cMoveRequest = new DicomMessage(DimseCommand.CMOVERQ);

            cMoveRequest.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.2");
            cMoveRequest.Set("0x00000600", VR.AE, "MOVE_DESTINATION");
            cMoveRequest.Set("0x00080052", VR.CS, "IMAGE");
            cMoveRequest.Set("0x00100020", VR.LO, "1");
            cMoveRequest.Set("0x0020000D", VR.UI, "1.1");
            cMoveRequest.Set("0x0020000E", VR.UI, "1.1.1");
            cMoveRequest.Set("0x00080018", VR.UI, "1.1.1.1", "1.1.1.3");

            DvtkData.Collections.StringCollection fileNames = queryRetrievePatientRootInformationModel.RetrieveInformationModel(cMoveRequest);

            Assert.That(fileNames.Count, Is.EqualTo(0));
        }
        //
        // - Test methods -
        //

        /// <summary>
        /// Common code for the Ticket788_1_... test cases.
        /// </summary>
        private void Ticket788CommonCode1(String patientName, out QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel, out DicomMessage cFindRequest)
        {
            queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();
            cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);
            DicomFile dicomFile = null;

            queryRetrievePatientRootInformationModel.DataDirectory = Paths.DataDirectoryFullPath;

            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00100010", VR.PN, patientName);                      // Patient name attribute.
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "PATIENT");                        // Query Retrieve Level.

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @".$^{[(|)*+?\1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @".$^{[(|)*+?\2");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @"Patient name containing no regular expression operators");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);
        }
        public void Ticket788_32_1()
        {
            DicomFile dicomFile = null;

            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080060", VR.CS, "OT"); // # Modality
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "2");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "2.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "2.1.1");
            dicomFile.DataSet.Set("0x00080060", VR.CS, "XA"); // # Modality
            dicomFile.DataSet.Set("0x00080018", VR.UI, "2.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            DicomMessage cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);

            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "SERIES");                         // Query Retrieve Level.
            cFindRequest.DataSet.Set("0x00100020", VR.LO, "1");
            cFindRequest.DataSet.Set("0x0020000D", VR.UI, "1.1");
            cFindRequest.DataSet.Set("0x0020000E", VR.UI);
            cFindRequest.DataSet.Set("0x00080060", VR.CS, "ECG");

            DicomMessageCollection responses = queryRetrievePatientRootInformationModel.QueryInformationModel(cFindRequest);

            // Expect one message with status success.
            Assert.That(responses.Count, Is.EqualTo(1));
        }
 /// <summary>
 /// Class Constructor.
 /// </summary>
 public QueryRetrieveInformationModels()
 {
     _patientRootInformationModel      = new QueryRetrievePatientRootInformationModel();
     _studyRootInformationModel        = new QueryRetrieveStudyRootInformationModel();
     _patientStudyOnlyInformationModel = new QueryRetrievePatientStudyOnlyInformationModel();
 }
        //
        // - Test methods -
        //
        /// <summary>
        /// Common code for the Ticket788_1_... test cases.
        /// </summary>
        private void Ticket788CommonCode1(String patientName, out QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel, out DicomMessage cFindRequest)
        {
            queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();
            cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);
            DicomFile dicomFile = null;

            queryRetrievePatientRootInformationModel.DataDirectory = Paths.DataDirectoryFullPath;

            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00100010", VR.PN, patientName); // Patient name attribute.
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "PATIENT"); // Query Retrieve Level.

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @".$^{[(|)*+?\1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @".$^{[(|)*+?\2");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100010", VR.PN, @"Patient name containing no regular expression operators");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);
        }
        public void Ticket1361_1_1()
        {
            DicomFile dicomFile = null;

            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile,false);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "2");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "2.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "2.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "2.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile, false);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "3");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "3.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "3.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "3.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile, false);

            DicomMessage cMoveRequest = new DicomMessage(DimseCommand.CMOVERQ);

            cMoveRequest.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.2");
            cMoveRequest.Set("0x00000600", VR.AE, "MOVE_DESTINATION");
            cMoveRequest.Set("0x00080052", VR.CS, "PATIENT");
            cMoveRequest.Set("0x00100020", VR.LO, "2");

            DvtkData.Collections.StringCollection fileNames = queryRetrievePatientRootInformationModel.RetrieveInformationModel(cMoveRequest);

            Assert.That(fileNames.Count, Is.EqualTo(0));
        }
        public void Ticket788_32_1()
        {
            DicomFile dicomFile = null;

            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080060", VR.CS, "OT"); // # Modality
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "2");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "2.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "2.1.1");
            dicomFile.DataSet.Set("0x00080060", VR.CS, "XA"); // # Modality
            dicomFile.DataSet.Set("0x00080018", VR.UI, "2.1.1.1");
            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            DicomMessage cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);
            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "SERIES"); // Query Retrieve Level.
            cFindRequest.DataSet.Set("0x00100020", VR.LO, "1");
            cFindRequest.DataSet.Set("0x0020000D", VR.UI, "1.1");
            cFindRequest.DataSet.Set("0x0020000E", VR.UI);
            cFindRequest.DataSet.Set("0x00080060", VR.CS, "ECG");

            DicomMessageCollection responses = queryRetrievePatientRootInformationModel.QueryInformationModel(cFindRequest);

            // Expect one message with status success.
            Assert.That(responses.Count, Is.EqualTo(1));
        }
        /// <summary>
        /// Returns number of responses.
        /// </summary>
        /// <param name="studyTime"></param>
        /// <param name="StydyTimeRange"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        private int Ticket788CommonCode2(String studyTime,
            String StydyTimeRange)
        {
            QueryRetrievePatientRootInformationModel queryRetrievePatientRootInformationModel = new QueryRetrievePatientRootInformationModel();

            DicomFile dicomFile = new DicomFile();
            dicomFile.DataSet.Set("0x00100020", VR.LO, "1");
            dicomFile.DataSet.Set("0x0020000D", VR.UI, "1.1");
            dicomFile.DataSet.Set("0x0020000E", VR.UI, "1.1.1");
            dicomFile.DataSet.Set("0x00080018", VR.UI, "1.1.1.1");

            dicomFile.DataSet.Set("0x00080020", VR.DA, "20090225"); // Study date.
            dicomFile.DataSet.Set("0x00080030", VR.TM, studyTime); // Study time.

            queryRetrievePatientRootInformationModel.AddToInformationModel(dicomFile);

            DicomMessage cFindRequest = new DicomMessage(DimseCommand.CFINDRQ);

            cFindRequest.CommandSet.Set("0x00000002", VR.UI, "1.2.840.10008.5.1.4.1.2.1.1"); // Set Affected SOP class to Patient Root Query/Retrieve Information Model – FIND
            cFindRequest.DataSet.Set("0x00100020", VR.LO, "1"); // Patient ID.
            cFindRequest.DataSet.Set("0x0020000D", VR.UI); // Study instance UID.
            cFindRequest.Set("0x00080030", VR.TM, StydyTimeRange); // Study time.
            cFindRequest.DataSet.Set("0x00080052", VR.CS, "STUDY"); // Query Retrieve Level.

            DicomMessageCollection cFindResponses = queryRetrievePatientRootInformationModel.QueryInformationModel(cFindRequest);

            return (cFindResponses.Count);
        }