I have the following code:
[TestMethod]
public void A_Player_Can_Be_Deleted_From_The_List()
{
Player player = playerList.Find(ByName("Davy",whatGoesHere?);
playerList.Remove(player);
playerList.Count.Should().Be(2);
}
The Func ‘ByName’ is defined as:
Func<string, Player, bool> ByName = (name, player) => player.Name == name;
I don’t know how to pass the second (player) parameter. Is it possible?
The
playeris provided to a predicate you pass toList.Find<T>, so you can just pass that toByName:Instead of using
FindandRemoveyou can useList<T>.RemoveAlli.e.