コード例 #1
0
 private void ValidateByteBufferLength(DicomVR dicomVR, string name, IByteBuffer value)
 {
     if (value?.Size != ExpectedLength)
     {
         throw ElementValidationExceptionFactory.CreateUnexpectedLengthException(name, dicomVR, ExpectedLength);
     }
 }
コード例 #2
0
 private void ValidateStringLength(DicomVR dicomVR, string name, string value)
 {
     value = value ?? "";
     if (value.Length != ExpectedLength)
     {
         throw ElementValidationExceptionFactory.CreateUnexpectedLengthException(name, dicomVR, value, ExpectedLength);
     }
 }
コード例 #3
0
        public void GivenUnexpectedLengthExceptionWithoutValue_WhenGetMessage_ShouldReturnExpected()
        {
            var name           = "tagname";
            var vr             = DicomVR.DA;
            var expectedLength = 8;
            var exception      = ElementValidationExceptionFactory.CreateUnexpectedLengthException(name, vr, expectedLength);

            Assert.Equal($"Dicom element '{name}' failed validation for VR '{vr}': Value length is not {expectedLength}.", exception.Message);
        }