Moq with Task await

后端 未结 3 683
滥情空心
滥情空心 2021-02-03 17:43

Since I have converted my WCF methods to Async, my unit tests have failed, and I can\'t figure out the correct syntax to get them to work.

Cllient proxy class

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 18:25

    I think you need to return the Task from the DoSomething mock

    this._mockService.Setup(x => x.DoSomething(It.IsAny(), It.IsAny()))
        .Returns(Task.FromResult(0));
    

提交回复
热议问题