Beispiel #1
0
        public void ValidationException_using_ValidationError_with_ErrorCode_FieldName_and_ErrorMessage()
        {
            var exception = ValidationException.CreateException(new ValidationError(errorCode, "fieldName", customErrorMessage));

            Assert.That(exception.ErrorCode, Is.EqualTo(errorCode));
            Assert.That(exception.Message, Is.EqualTo(customErrorMessage));
            Assert.That(exception.ErrorMessage, Is.EqualTo(customErrorMessage));
        }
Beispiel #2
0
        public void ValidationException_with_ErrorCode_and_ErrorMessage_uses_that_as_the_message()
        {
            var exception = ValidationException.CreateException(errorCode, customErrorMessage);

            Assert.That(exception.ErrorCode, Is.EqualTo(errorCode));
            Assert.That(exception.Message, Is.EqualTo(customErrorMessage));
            Assert.That(exception.ErrorMessage, Is.EqualTo(customErrorMessage));
        }
Beispiel #3
0
        public void ValidationException_using_ValidationError_with_ErrorCode()
        {
            var exception = ValidationException.CreateException(new ValidationError(errorCode));

            Assert.That(exception.ErrorCode, Is.EqualTo(errorCode));
            Assert.That(exception.Message, Is.EqualTo(errorMessage));
            Assert.That(exception.ErrorMessage, Is.EqualTo(errorMessage));
        }
Beispiel #4
0
        public void ValidationException_with_only_ErrorCode_uses_that_as_the_message()
        {
            var exception = ValidationException.CreateException(errorCode);

            Assert.That(exception.ErrorCode, Is.EqualTo(errorCode));
            Assert.That(exception.Message, Is.EqualTo(errorCode.SplitCamelCase()));
            Assert.That(exception.ErrorMessage, Is.EqualTo(errorCode.SplitCamelCase()));
        }