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
精彩评论