How to Write a Custom Validator that shows Failure in Calling Function

Class library usage, coding and language questions.
Taz
Posts: 10
Joined: Thu Mar 03, 2022 8:58 am

How to Write a Custom Validator that shows Failure in Calling Function

Post by Taz » Wed Nov 15, 2023 5:47 pm

How can I make this function below in a custom code library behave the same way as those in-build Validation functions? The problem with this one is that when it reports a failure in my report and I click on the link, it returns me to this function and not the calling one that caused the error. How can I make it so that I will be returned to the calling function?

Code: Select all

 public static bool ValidateAreEqual(object actual, object expected, string message, bool exceptionOnFail)
        {
        	if (actual == null)
        		actual = "null";
        	return Validate.AreEqual(actual, expected, $"{message} - Actual: '{actual}', Expected: '{expected}'", exceptionOnFail)
        }