Пример #1
0
        public void TestMongoExpectedFilesDoc_FromMessage()
        {
            var mockMessage = new Mock <ExtractFileCollectionInfoMessage>();

            mockMessage.Object.KeyValue = "TestKey";
            Guid jobId = Guid.NewGuid();

            mockMessage.Object.ExtractionJobIdentifier = jobId;
            var header1 = new MessageHeader();
            var header2 = new MessageHeader();

            mockMessage.Object.ExtractFileMessagesDispatched = new JsonCompatibleDictionary <MessageHeader, string>
            {
                { header1, "AnonFile1.dcm" },
                { header2, "AnonFile2.dcm" },
            };
            mockMessage.Object.RejectionReasons = new Dictionary <string, int>
            {
                { "Reject1", 1 },
                { "Reject2", 2 },
            };

            MongoExpectedFilesDoc doc = MongoExpectedFilesDoc.FromMessage(mockMessage.Object, _testHeader, _dateTimeProvider);

            var expected = new MongoExpectedFilesDoc(
                MongoExtractionMessageHeaderDoc.FromMessageHeader(jobId, _testHeader, _dateTimeProvider),
                "TestKey",
                new HashSet <MongoExpectedFileInfoDoc>
            {
                new MongoExpectedFileInfoDoc(header1.MessageGuid, "AnonFile1.dcm"),
                new MongoExpectedFileInfoDoc(header2.MessageGuid, "AnonFile2.dcm"),
            },
                MongoRejectedKeyInfoDoc.FromMessage(mockMessage.Object, _testHeader, _dateTimeProvider));

            Assert.AreEqual(expected, doc);
        }
Пример #2
0
        public void TestMongoRejectedKeyInfoDoc_FromMessage()
        {
            var  mockMessage = new Mock <ExtractFileCollectionInfoMessage>();
            Guid jobId       = Guid.NewGuid();

            mockMessage.Object.ExtractionJobIdentifier = jobId;
            mockMessage.Object.RejectionReasons        = new Dictionary <string, int>
            {
                { "Reject1", 1 },
                { "Reject2", 2 },
            };

            MongoRejectedKeyInfoDoc doc = MongoRejectedKeyInfoDoc.FromMessage(mockMessage.Object, _testHeader, _dateTimeProvider);

            var expected = new MongoRejectedKeyInfoDoc(
                MongoExtractionMessageHeaderDoc.FromMessageHeader(jobId, _testHeader, _dateTimeProvider),
                new Dictionary <string, int>
            {
                { "Reject1", 1 },
                { "Reject2", 2 },
            });

            Assert.AreEqual(expected, doc);
        }