Reputation: 1135
I have an interface that is defined like the following
public interface IFoo
{
object this[string key] { get; }
}
How can I mock this indexer using NSubstitute?
Upvotes: 7
Views: 2317
Reputation: 10464
Call the indexer then use Returns
:
var sub = Substitute.For<IFoo>();
sub["hello"].Returns("world");
Upvotes: 14