Michael
Michael

Reputation: 61

Unit Test which verifies value is in the list

I have a code to do below

webNodeService.write("W100", new List<webNode>() { webaddress="C1", inputValue="Example" });

Then I want to do the unit test to verify the value of webnode

webNodeService.Verify(v => v.Write("W100", It.IsAny<List<webNode>>()));

Beside, use callback, is anyway to verify the list of webnode is my expected

Thank you

Upvotes: 0

Views: 463

Answers (1)

NiS&#248;
NiS&#248;

Reputation: 49

Instead of It.IsAny<> you could try using:

It.Is<List<webNode>>(list => list.Should().Match(etc etc))

Upvotes: 1

Related Questions