示例#1
0
        public void AssociateAC_WriteRead_ExpectedExtendedNegotiation(DicomUID sopClassUid, DicomServiceApplicationInfo applicationInfo, DicomUID commonServiceClass, DicomUID[] relatedSopClasses)
        {
            var inAssociation = new DicomAssociation("testCalling", "testCalled");

            inAssociation.ExtendedNegotiations.Add(sopClassUid, applicationInfo, commonServiceClass, relatedSopClasses);
            var acceptedApplicationInfo = new DicomServiceApplicationInfo(applicationInfo.GetValues());

            acceptedApplicationInfo.AddOrUpdate(1, 10);
            inAssociation.ExtendedNegotiations.AcceptApplicationInfo(sopClassUid, acceptedApplicationInfo);

            var ac       = new AAssociateAC(inAssociation);
            var writePdu = ac.Write();

            var readPdu = ConvertWriteToReadPdu(writePdu);

            var outAssociation = new DicomAssociation();

            outAssociation.ExtendedNegotiations.Add(sopClassUid, applicationInfo);
            var ac2 = new AAssociateAC(outAssociation);

            ac2.Read(readPdu);

            Assert.Single(outAssociation.ExtendedNegotiations);
            var negotiation = outAssociation.ExtendedNegotiations.First();

            Assert.Equal(sopClassUid, negotiation.SopClassUid);
            Assert.Equal(applicationInfo, negotiation.RequestedApplicationInfo);
            Assert.Equal(acceptedApplicationInfo, negotiation.AcceptedApplicationInfo);
            Assert.Null(negotiation.ServiceClassUid);
            Assert.Empty(negotiation.RelatedGeneralSopClasses);
        }
示例#2
0
        public void AssociateRQ_WriteRead_ExpectedExtendedNegotiation(DicomUID sopClassUid, DicomServiceApplicationInfo applicationInfo, DicomUID commonServiceClass, DicomUID[] relatedSopClasses)
        {
            var association = new DicomAssociation("testCalling", "testCalled");

            association.ExtendedNegotiations.Add(sopClassUid, applicationInfo, commonServiceClass, relatedSopClasses);

            var rq       = new AAssociateRQ(association);
            var writePdu = rq.Write();

            var readPdu = ConvertWriteToReadPdu(writePdu);

            var testAssociation = new DicomAssociation();
            var rq2             = new AAssociateRQ(testAssociation);

            rq2.Read(readPdu);

            Assert.Single(testAssociation.ExtendedNegotiations);
            var negotiation = testAssociation.ExtendedNegotiations.First();

            Assert.Equal(sopClassUid, negotiation.SopClassUid);
            Assert.Equal(applicationInfo, negotiation.RequestedApplicationInfo);
            Assert.Equal(commonServiceClass, negotiation.ServiceClassUid);
            Assert.Equal(relatedSopClasses, negotiation.RelatedGeneralSopClasses);
            Assert.Null(negotiation.AcceptedApplicationInfo);
        }