Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void Write_AeWithNonAsciiCharacters_ShouldBeAsciified()
        {
            var notExpected = "GÖTEBORG";
            var request     = new AAssociateRQ(new DicomAssociation("MALMÖ", notExpected));

            var writePdu = request.Write();
            var readPdu  = ConvertWriteToReadPdu(writePdu);

            readPdu.Reset();
            readPdu.SkipBytes("Unknown", 10);
            var actual = readPdu.ReadString("Called AE", 16);

            Assert.NotEqual(notExpected, actual);
        }