Is there some .Net mocking framework that allows to capture the actual parameter passed to method to examine it latter?
Desired code:
var foo = Mock<Foo>();
var service = Mock<IService>();
service.Expect(s => s.Create(foo));
service.Create(new Foo { Currency = "USD" });
Assert(foo.Object.Currency == "USD");
Or a bit more complex example:
Foo foo = new Foo { Title = "...", Description = "..." };
var bar = Mock.NewHook<Bar>();
var service = new Mock<IService>();
service.Expect(s => s.Create(bar));
new Controller(service.Object).Create(foo);
Assert(foo.Title == bar.Object.Title);
Assert(foo.Description == bar.Object.Description);
The idea is to get passed parameter. And then execute aseertions agains it.