var storageManager = new Mock();
storageManager.Setup(e => e.Add(It.IsAny()));
The Add() method expect
You can use Verify
.
Examples:
Verify that Add
was never called with an UserMetaData
with FirstName
!= "FirstName1"
:
storageManager.Verify(e => e.Add(It.Is(d => d.FirstName!="FirstName1")), Times.Never());
Verify that Add
was called at least once with an UserMetaData
with FirstName
== "FirstName1"
:
storageManager.Verify(e => e.Add(It.Is(d => d.FirstName=="FirstName1")), Times.AtLeastOnce());
Verify that Add
was called exactly once with FirstName
== "Firstname1"
and LastName
== "LastName2"
:
storageManager.Setup(e => e.Add(It.Is(data => data.FirstName == "FirstName1"
&& data.LastName == "LastName2")));
...
storageManager.VerifyAll();