Using Moq, how do I set up a method call with an input parameter as an object with expected property values?

前端 未结 3 2023
一生所求
一生所求 2021-02-01 14:35
 var storageManager = new Mock(); 
 storageManager.Setup(e => e.Add(It.IsAny()));

The Add() method expect

3条回答
  •  执笔经年
    2021-02-01 15:24

    You can use the It.Is method:

    storageManager.Setup(e => e.Add(It.Is(data => data.FirstName == "FirstName1")));
    

提交回复
热议问题