问题
I'm using Machine spec / Shouldly and testing a mapping profile (mundane work). The mapping expectations are sometimes inconsistent. Sometimes I am seeing an ""
explicit empty string get returned and sometimes it's a null value. Since we're mapping to a spreadsheet it doesn't matter on that front but it gets a little annoying when asserting.
Is there a way in Machine spec to do something like assertionValue.ShouldEqual(null || "")
?
回答1:
Assert on the outcome of string.IsNullOrEmpty()
来源:https://stackoverflow.com/questions/49183102/c-sharp-in-my-unit-test-i-want-to-see-if-it-is-null-or-an-empty-string