Esempio n. 1
0
        public void TestPersistMessageToStoreImpl_IsIdentifiableMessage()
        {
            var client = new TestMongoClient();
            var store  = new MongoExtractJobStore(client, ExtractionDatabaseName, _dateTimeProvider);

            Guid jobId = Guid.NewGuid();
            var  testIsIdentifiableMessage = new ExtractedFileVerificationMessage
            {
                OutputFilePath          = "anon.dcm",
                JobSubmittedAt          = _dateTimeProvider.UtcNow(),
                ProjectNumber           = "1234",
                ExtractionJobIdentifier = jobId,
                ExtractionDirectory     = "1234/test",
                DicomFilePath           = "original.dcm",
                IsIdentifiable          = false,
                Report = "[]", // NOTE(rkm 2020-03-10) An "empty" report from IsIdentifiable
            };
            var header = new MessageHeader();

            store.PersistMessageToStore(testIsIdentifiableMessage, header);

            Dictionary <Guid, MongoFileStatusDoc> docs = client.ExtractionDatabase.StatusCollections[$"statuses_{jobId}"].Documents;

            Assert.AreEqual(docs.Count, 1);
            MongoFileStatusDoc statusDoc = docs.Values.ToList()[0];

            var expected = new MongoFileStatusDoc(
                MongoExtractionMessageHeaderDoc.FromMessageHeader(jobId, header, _dateTimeProvider),
                "original.dcm",
                "anon.dcm",
                true,
                false,
                ExtractedFileStatus.Anonymised,
                "[]");

            Assert.True(statusDoc.Equals(expected));
        }
Esempio n. 2
0
        public void TestPersistMessageToStoreImpl_ExtractFileStatusMessage()
        {
            var client = new TestMongoClient();
            var store  = new MongoExtractJobStore(client, ExtractionDatabaseName, _dateTimeProvider);

            Guid jobId = Guid.NewGuid();
            var  testExtractFileStatusMessage = new ExtractedFileStatusMessage
            {
                OutputFilePath          = "anon.dcm",
                JobSubmittedAt          = _dateTimeProvider.UtcNow(),
                Status                  = ExtractedFileStatus.ErrorWontRetry,
                ProjectNumber           = "1234",
                ExtractionJobIdentifier = jobId,
                ExtractionDirectory     = "1234/test",
                StatusMessage           = "Could not anonymise",
                DicomFilePath           = "original.dcm",
            };
            var header = new MessageHeader();

            store.PersistMessageToStore(testExtractFileStatusMessage, header);

            Dictionary <Guid, MongoFileStatusDoc> docs = client.ExtractionDatabase.StatusCollections[$"statuses_{jobId}"].Documents;

            Assert.AreEqual(docs.Count, 1);
            MongoFileStatusDoc statusDoc = docs.Values.ToList()[0];

            var expected = new MongoFileStatusDoc(
                MongoExtractionMessageHeaderDoc.FromMessageHeader(jobId, header, _dateTimeProvider),
                "original.dcm",
                "anon.dcm",
                false,
                true,
                ExtractedFileStatus.ErrorWontRetry,
                "Could not anonymise");

            Assert.True(statusDoc.Equals(expected));
        }