Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

New Post: Method proposal: str.Should().BeBlank()

$
0
0

My idea is to call a string "blank" when it is null or empty or whitespace-only.

Microsoft in .Net 4 came up with the name IsNullOrWhiteSpace but it's too long to my taste so I use alias "IsBlank".

In the code I write now I never check strings separately for null or empty or whitespace. I call this class of strings "blank" because it is not "visible".

Usually when I get a blank string I don't do any processing on it regardless whether it is null, empty or whitespace-only.

Hence in my unit tests I just check if a string is blank or non-blank.

 

I would prefer IsBlank to capture null, empty and whitespace-only strings.

This way IsNull and IsEmpty are finer-grained "subset" methods of IsBlank and they all have their own use.


Viewing all articles
Browse latest Browse all 1402

Trending Articles


FLASHBACK WITH SIRASA FM AT GALGAMUWA 2022


Mp3 Download: Mdu - Mazola


Imitation gun was fired at motorist in Leicester road-rage incident


Ndebele names


MCKINNEY EMALINE “EMMA” OF WES...


Okra & Motia — The Workshop (Prod by Hammer)


Skint TV teen to be sentenced


Moondru Mudichu 19-09-2017 – Polimer tv Serial


YOSVANI JAMES Arrested by Miami-Dade County Corrections on Jan 10, 2017


Stories • Goddess Stepmom



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>