I'm trying to get nsubstitute to mock an instance of IStringLocalizer like this
var mock = Substitute.For<IStringLocalizer<SomeClass>>();
mock["Foo"].Returns("Bar");
Assert.That(mock["Foo"], Is.EqualTo("Bar"));
How can I do this?
I'm trying to get nsubstitute to mock an instance of IStringLocalizer like this
var mock = Substitute.For<IStringLocalizer<SomeClass>>();
mock["Foo"].Returns("Bar");
Assert.That(mock["Foo"], Is.EqualTo("Bar"));
How can I do this?
Try this:
In documentation of
IStringLocalizeryou can see that indexer of this type are returnsLocalizedStringwhich can not be explicit/implicit cast toSystem.Stringso you need to specify explicitly newLocalizedStringforReturnsmethod.