New answers tagged

1

Change mediaManager.GetMediaUrl(mediaItem).Returns("/a/path/to/an/image.jpg"); to mediaManager.GetMediaUrl(Arg.Is<MediaItem>(mi => mi.ID == mediaItem.ID)).Returns("/a/path/to/an/image.jpg"); Looks like there happens something with object references in the background so that's not the same object anymore and in result the ...


3

If you go into ImageField.MediaItem getter, you'll notice that the MediaDatabase.GetItem() method uses 3 parameters including language and version: this.mediaItem = this.MediaDatabase.GetItem(mediaId, this.MediaLanguage, this.MediaVersion); In your test you mock another overload of the GetItem() method that uses ID only: database.GetItem(new ID("...


Top 50 recent answers are included