public void DictionaryField_NoTranslationItemExists_ReturnDefaultValue(string path, string defaultValue) { //Arrange this.dictionaryPhraseRepository.GetItem(path, defaultValue).Returns(x => null); //Act var result = SitecoreExtensions.DictionaryField(null, path, defaultValue); //Assert result.ToHtmlString().Should().Be(defaultValue); }
public void DictionaryField_TranslationItemExists_ReturnFieldRenderer(string path, string defaultValue, Item translateItem, [Substitute] SitecoreHelper sitecoreHelper) { //Arrange this.dictionaryPhraseRepository.GetItem(path, defaultValue).Returns(x => translateItem); sitecoreHelper.Field(Arg.Any <string>(), Arg.Any <Item>()).Returns(x => new HtmlString($"fieldId:{x.Arg<string>()} itemId:{x.Arg<Item>().ID}")); //Act var result = SitecoreExtensions.DictionaryField(sitecoreHelper, path, defaultValue); //Assert result.ToHtmlString().Should().Be($"fieldId:{{DDACDD55-5B08-405F-9E58-04F09AED640A}} itemId:{translateItem.ID}"); }