Ejemplo n.º 1
0
        public void QueryReturnsKnownTransferSyntax()
        {
            var uid = DicomUID.ImplicitVRLittleEndian;
            var ts  = DicomTransferSyntax.Query(uid);

            Assert.NotNull(ts);
            Assert.Equal(uid, ts.UID);
        }
Ejemplo n.º 2
0
        public void QueryReturnsNullIfNotRegistered()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            var ts = DicomTransferSyntax.Query(uid);

            Assert.Null(ts);
        }
Ejemplo n.º 3
0
        public void UnregisterUnregistersTransferSyntax()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            DicomTransferSyntax.Register(uid);
            Assert.NotNull(DicomTransferSyntax.Query(uid));

            DicomTransferSyntax.Unregister(uid);
            Assert.Null(DicomTransferSyntax.Query(uid));
        }
Ejemplo n.º 4
0
        public void QueryReturnsRegisteredTransferSyntax()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            DicomTransferSyntax.Register(uid);

            var ts = DicomTransferSyntax.Query(uid);

            Assert.NotNull(ts);
            Assert.Equal(uid, ts.UID);

            DicomTransferSyntax.Unregister(uid);
        }
Ejemplo n.º 5
0
        public void UnregisterHandleMultipleUnregistrations()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            DicomTransferSyntax.Register(uid);
            Assert.NotNull(DicomTransferSyntax.Query(uid));

            Assert.True(DicomTransferSyntax.Unregister(uid));
            Assert.Null(DicomTransferSyntax.Query(uid));

            Assert.False(DicomTransferSyntax.Unregister(uid));
            Assert.Null(DicomTransferSyntax.Query(uid));
        }
Ejemplo n.º 6
0
        public void LookupReturnsAdHocTransferSyntax()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            var ts = DicomTransferSyntax.Lookup(uid);

            Assert.NotNull(ts);
            Assert.Equal(uid, ts.UID);

            //  Lookup must not auto-register, as it is invoked from DicomServer.
            //  auto-registration may cause DoS by sending crafted transfer syntaxes repeatedly,
            //  which causes internal static dictionary to hold all the transfer syntaxes.
            Assert.Null(DicomTransferSyntax.Query(uid));
        }
Ejemplo n.º 7
0
        public void RegisterRegistersTransferSyntax()
        {
            var uid = new DicomUID("0", "testing", DicomUidType.TransferSyntax);

            Assert.Null(DicomTransferSyntax.Query(uid));

            var ts1 = DicomTransferSyntax.Register(uid);

            Assert.NotNull(ts1);

            var ts2 = DicomTransferSyntax.Query(uid);

            Assert.Equal(uid, ts2.UID);

            DicomTransferSyntax.Unregister(uid);
        }