Click here to Skip to main content
16,019,983 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to convert this assertion and instead use .Any(), any help appriciated

Assert.True(TestHelpers.Players.Count(x => x.Value.CustId == gameClient.CustId && x.Value.Group == gameClient.Group) == 0);


What I have tried:

Not straightforward as I thought
Posted
Updated 6-Jun-22 3:53am
Comments
Richard MacCutchan 6-Jun-22 9:45am    
What item do you need to check in your Any clause?

Try this:
C#
Assert.True(TestHelpers.Players.Any(x => x.Value.CustId == gameClient.CustId && x.Value.Group == gameClient.Group));
 
Share this answer
 
Assert.False(TestHelpers.Players.Any(x => x.Value.CustId == gameClient.CustId && x.Value.Group == gameClient.Group), "Player Active");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900