开发者

Moq - Need mocked function to return value passed in

I have a mock t开发者_StackOverflowhat i have setup like this. I need to return the same value that was passed in to .CreatePersonName

mock.Setup(m => m.CreatePersonName(It.IsAny<PersonName>()))
            .Returns(// what do i put here?);


mock.Setup(m => m.CreatePersonName(It.IsAny<PersonName>()))
            .Returns((PersonName p) => p);

Based on:

// access invocation arguments when returning a value
mock.Setup(x => x.DoSomething(It.IsAny<string>()))
                .Returns((string s) => s.ToLower());

from https://github.com/Moq/moq4/wiki/Quickstart

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜