private void ValidateByteBufferLength(DicomVR dicomVR, string name, IByteBuffer value)
 {
     if (value?.Size != ExpectedLength)
     {
         throw ElementValidationExceptionFactory.CreateUnexpectedLengthException(name, dicomVR, ExpectedLength);
     }
 }
 private void ValidateStringLength(DicomVR dicomVR, string name, string value)
 {
     value = value ?? "";
     if (value.Length != ExpectedLength)
     {
         throw ElementValidationExceptionFactory.CreateUnexpectedLengthException(name, dicomVR, value, ExpectedLength);
     }
 }
        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);
        }