コード例 #1
0
        public void GivenAChangeFeedEntryWithInvalidUtcTimeOffset_WhenDateTimeOffsetIsCalculated_ThenInvalidDicomTagValueExceptionIsThrown()
        {
            FhirTransactionContext fhirTransactionContext = FhirTransactionContextBuilder.DefaultFhirTransactionContext();

            fhirTransactionContext.ChangeFeedEntry.Metadata.Add(DicomTag.TimezoneOffsetFromUTC, "0");

            Assert.Throws <InvalidDicomTagValueException>(
                () => ImagingStudyPipelineHelper.SetDateTimeOffSet(fhirTransactionContext));
        }
コード例 #2
0
        public void GivenAChangeFeedEntry_WhenDateTimeOffsetIsCalculated_ThenDateTimeOffsetIsSet(int hour, int minute, string dicomValue)
        {
            FhirTransactionContext fhirTransactionContext = FhirTransactionContextBuilder.DefaultFhirTransactionContext();

            DateTimeOffset utcTimeZoneOffset = new DateTimeOffset(2020, 1, 1, 0, 0, 0, new TimeSpan(hour, minute, 0));

            fhirTransactionContext.ChangeFeedEntry.Metadata.Add(DicomTag.TimezoneOffsetFromUTC, dicomValue);

            ImagingStudyPipelineHelper.SetDateTimeOffSet(fhirTransactionContext);

            Assert.Equal(utcTimeZoneOffset.Offset, fhirTransactionContext.UtcDateTimeOffset);
        }
コード例 #3
0
        public void GivenAChangeFeedEntry_WhenDateTimeOffsetIsCalculated_ThenDateTimeOffsetIsSet()
        {
            FhirTransactionContext fhirTransactionContext = FhirTransactionContextBuilder.DefaultFhirTransactionContext();

            DateTimeOffset utcTimeZoneOffset = DateTimeOffset.Now;

            fhirTransactionContext.ChangeFeedEntry.Metadata.Add(DicomTag.TimezoneOffsetFromUTC, utcTimeZoneOffset.ToString(FhirTransactionConstants.UtcTimezoneOffsetFormat));

            ImagingStudyPipelineHelper.SetDateTimeOffSet(fhirTransactionContext);

            Assert.Equal(utcTimeZoneOffset.Offset, fhirTransactionContext.UtcDateTimeOffset);
        }