2010-10-14 2 views

ответ

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

основе:

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

из http://code.google.com/p/moq/wiki/QuickStart

+0

большое спасибо –

+0

код теперь переносятся на GitHub: HTTPS : //github.com/Moq/moq4/wiki/Quickstart – miltonb