public void CEcho()
        {
            var association = CreateAssociation();
            var activeAssociation = CreateActiveAssociation(association);
            Expect.Call(association.GetAcceptedTransferSyntaxUID(1)).Return("");
            var dicomCommand = mockRepository.DynamicMock<IDicomCommand>();
            Expect.Call(dcmObjectFactory.NewCommand()).Return(dicomCommand);
            Expect.Call(dicomCommand.InitCEchoRQ(0)).Return(dicomCommand);
            var dimse = mockRepository.DynamicMock<IDimse>();
            Expect.Call(associationFactory.NewDimse(1, dicomCommand)).Return(dimse);
            var presContext = mockRepository.DynamicMock<PresentationContext>(0x20, 2, 3, "", tranferSyntax);
            Expect.Call(associationFactory.NewPresContext(1, UIDs.Verification, tranferSyntax)).Return(presContext);
            //Expect.Call(() => _aAssociateRq.AddPresContext(presContext));
            Expect.Call(activeAssociation.Invoke(dimse)).Return(null);
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            var succeed = scu.CEcho();

            Assert.IsTrue(succeed);
        }
        public void AttemptCMoveForMultipleStudiesAndMultipleSeries()
        {
            SetUpCFind();
            SetUpCFind();
            //SetUpCMove(1);
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);
            var studyInstanceUIDs = new List<string> {
                                                         "1.3.12.2.1107.5.1.4.1031.30000009082111200307800000018",
                                                         "1.3.46.670589.11.5019.5.0.5844.2009082111084362050",
                                                         "1.2.124.113532.10.33.162.50.20090812.81504.24624529"
                                                     };
            var seriesInstanceUIDs = new List<string> {
                                                          "1.3.12.2.1107.5.1.4.1031.30000009082111213876500007458",
                                                          "1.3.46.670589.11.5019.5.0.4632.2009082111211140720",
                                                          "1.3.12.2.1107.5.1.4.1031.30000009082111223996800005593"
                                                      };

            IList<DataSet> cFindSeries = scu.CMove(studyInstanceUIDs, seriesInstanceUIDs, "FULLSTORAGE_SCP");

            Assert.IsNotNull(cFindSeries);
        }
        public void CEchoEndpointDoesNotSupportTheTransferSyntax()
        {
            var association = CreateAssociation();
            CreateActiveAssociation(association);
            var presContext = mockRepository.DynamicMock<PresentationContext>(0x20, 2, 3, "", tranferSyntax);
            Expect.Call(association.GetAcceptedTransferSyntaxUID(1)).Return(null);
            Expect.Call(associationFactory.NewPresContext(1, UIDs.Verification, tranferSyntax)).Return(presContext);
            //Expect.Call(() => aAssociateRq.AddPresContext(presContext));
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            var succeed = scu.CEcho();

            Assert.IsFalse(succeed);
        }
        public void WhenCMoveIsCalledWithNoStudiesOrSeriesInstanceUIDsPassedToItNoCallToTheSCP_IsMade()
        {
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            IList<DataSet> cFindSeries = scu.CMove(new List<string>(), new List<string>(), "FULLSTORAGE_SCP");

            Assert.IsNotNull(cFindSeries);
        }
        public void IssuingCancelOperationRequestToSCP()
        {
            var association = CreateAssociation();
            var activeAssociation = CreateActiveAssociation(association);
            var dicomCommand = mockRepository.DynamicMock<IDicomCommand>();
            Expect.Call(association.CurrentMessageId()).Return(1);
            Expect.Call(dcmObjectFactory.NewCommand()).Return(dicomCommand);
            var dimse = mockRepository.DynamicMock<IDimse>();
            var cancelAssociation = mockRepository.DynamicMock<IActiveAssociation>();
            Expect.Call(associationFactory.NewActiveAssociation(association, null)).Return(cancelAssociation);
            Expect.Call(associationFactory.NewDimse(1, dicomCommand)).Return(dimse);
            Expect.Call(dicomCommand.InitCCancelRQ(1)).Return(dicomCommand);
            Expect.Call(cancelAssociation.Start);
            Expect.Call(cancelAssociation.Invoke(dimse)).Return(null);
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            var cancelSuccess = scu.Cancel();

            Assert.IsTrue(cancelSuccess);
        }
        public void CMoveForStudies()
        {
            SetUpCFind();
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);
            var studyInstanceUIDs = new List<string> { "1.2.840.114165.8192.3.1.10.8047921150017449681.1" };

            IList<DataSet> cFindSeries = scu.CMove(studyInstanceUIDs, new List<string>(), "FULLSTORAGE_SCP");

            Assert.IsNotNull(cFindSeries);
        }
        public void CMoveForSeries()
        {
            SetUpCFind();
            //SetUpCMove(1);
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);
            var seriesInstanceUIDs = new List<string> { "1.2.840.114165.8192.3.1.10.4005887757780752754.2" };

            IList<DataSet> cFindSeries = scu.CMove(new List<string>(), seriesInstanceUIDs, "FULLSTORAGE_SCP");

            Assert.IsNotNull(cFindSeries);
        }
        public void CFindStudyByStudyInstanceUID()
        {
            SetUpCFind();
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            IList<DataSet> cFindSeries = scu.CFindStudy("1.2.840.114165.8192.3.1.10.8047921150017449681.1");

            Assert.IsNotNull(cFindSeries);
        }
        public void CFindInstance()
        {
            SetUpCFind();
            mockRepository.ReplayAll();
            var scu = new ServiceClassUser(unityContainer, "NEWTON", "DCM4CHEE", HOSTNAME, PORT);

            IList<DataSet> cFindSeries = scu.CFindInstance(new List<string>(), new List<string> { "1.2.840.114165.8192.3.1.10.4005887757780752754.2" });

            Assert.IsNotNull(cFindSeries);
        }