tags:

views:

31

answers:

1

I have a mock that 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?);
+1  A: 
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 http://code.google.com/p/moq/wiki/QuickStart

Jakub Konecki
thank you very much
wcpro