Beispiel #1
0
        public void Test_BlankPatientIdentifier(Test testCase)
        {
            var db = GetCleanedServer(DatabaseType.MicrosoftSQLServer);

            //the declaration of what the guid namer table should be
            var options = new IdentifierMapperOptions();

            options.MappingConnectionString = db.Server.Builder.ConnectionString;

            var swapper = new SwapForFixedValueTester("meeee");

            swapper.Setup(options);

            var consumer = new IdentifierMapperQueueConsumer(Mock.Of <IProducerModel>(), swapper);

            var msg = GetTestDicomFileMessage(testCase: testCase);

            string reason;

            Assert.False(consumer.SwapIdentifier(msg, out reason));

            switch (testCase)
            {
            case Test.EmptyInPatientTag:
                Assert.AreEqual("PatientID was blank", reason);
                break;

            case Test.NoPatientTag:
                Assert.AreEqual("Dataset did not contain PatientID", reason);
                break;
            }
        }
Beispiel #2
0
        public void Test_IdentifierMapper_LoggingCounts()
        {
            MemoryTarget target = new MemoryTarget();

            target.Layout = "${message}";

            var mapper = new SwapForFixedValueTester("fish");

            StringAssert.AreEqualIgnoringCase("fish", mapper.GetSubstitutionFor("heyyy", out _));

            Assert.AreEqual(1, mapper.Success);

            NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);

            Logger logger = LogManager.GetLogger("Example");

            mapper.LogProgress(logger, LogLevel.Info);

            StringAssert.StartsWith("SwapForFixedValueTester: CacheRatio=1:0 SuccessRatio=1:0:0", target.Logs.Single());
        }
Beispiel #3
0
        public void Test_NoMatchingIdentifierFound()
        {
            var db = GetCleanedServer(DatabaseType.MicrosoftSQLServer);

            //the declaration of what the guid namer table should be
            var options = new IdentifierMapperOptions();

            options.MappingConnectionString = db.Server.Builder.ConnectionString;

            //null here means it will never find any identifier
            var swapper = new SwapForFixedValueTester(null);

            swapper.Setup(options);

            var consumer = new IdentifierMapperQueueConsumer(Mock.Of <IProducerModel>(), swapper);

            var    msg = GetTestDicomFileMessage();
            string reason;

            Assert.False(consumer.SwapIdentifier(msg, out reason));
            Assert.AreEqual("Swapper Microservices.IdentifierMapper.Tests.SwapForFixedValueTester returned null", reason);
        }