tags:

views:

263

answers:

1

I can do:

var req = new Mock<HttpRequestBase>();
var vals = new Dictionary<string, string>();

req.Expect(r => r[It.IsAny<string>()])
    .Returns(s => vals[s]);

But what about something like this ???

req.ExpectSet(r => r[It.IsAny<string>()], It.IsAny<string>())
    .Callback((s, v) => vals[s] = v);
A: 

I don't believe so, I had to use Expect over ExpectSet when accessing indexers.

casperOne
Can you show an example please ?
Chris Porter