Blog Logo
TAGS

Error-accumulating composable assertions in C#

This article is about composing non-short-circuiting assertions in C# in such a way that failure messages accumulate. It explores a simpler API than the previous articles proof of concept, using a NotEmptyCollection collection to encapsulate knowledge that a collection is never empty. The article explains the advantages of encapsulating such knowledge in the type itself and provides code examples to illustrate its implementation. It concludes with a suggestion that perhaps the list monoid is all thats needed for non-short-circuiting assertions.