Assert.IsTrue(benefits.Count(P => string.IsNullOrEmpty(P.bCode)) > 0);
HEre benefits is list of objects of type Obj…which has one property bCode.
I want to check if all items in list benefits has “bCode”…not null and not empty.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can read about
Enumerable.Allon MSDN. Note that it exhibits “short-circuiting” behavior like&&(which is what it is analogous to). You can wrap this is inAssert.IsTrueif you so desire for your test runner.You should seriously consider renaming
bCodetoBenefitCode, assuming that is what it stands for. There is no reason to not use meaningful business names. Your ORM can handle it.