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?
Call the indexer then use Returns
:
var sub = Substitute.For<IFoo>();
sub["hello"].Returns("world");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With