private void QueryReturnsKnownTransferSyntax()
        {
            var uid = DicomUID.ImplicitVRLittleEndian;
            var ts  = DicomTransferSyntax.Query(uid);

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

            var ts = DicomTransferSyntax.Query(uid);

            Assert.Null(ts);
        }
        private 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));
        }
        private 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);
        }
        private 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));
        }
        private 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));
        }
        private 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);
        }