public void WHEN_Localized_Value_Is_Not_Found_SHOULD_Render_Formatted_Key_Hint() { //Arrange var localizationProvider = LocalizationProviderFactory.CreateKnowsNothing(); var helpers = new LocalizeHelper(localizationProvider.Object); Handlebars.RegisterHelper(helpers.HelperName, helpers.HelperFunction); string categoryName = GetRandom.String(32); string keyName = GetRandom.String(32); var template = Handlebars.Compile("{{localize CategoryName KeyName}}"); //Act var result = template.Invoke(new { CategoryName = categoryName, KeyName = keyName }); result.Should().Be(string.Format("[{0}.{1}]", categoryName, keyName), "Because this is the formatted value hint"); }
public void WHEN_Localized_Value_Is_Not_Found_Or_Null_Or_Empty_Found_SHOULD_Render_Inverse_Template() { //Arrange var localizationProvider = LocalizationProviderFactory.CreateKnowsNothing(); var helpers = new IfIsLocalizedBlockHelper(localizationProvider.Object); Handlebars.RegisterHelper(helpers.HelperName, helpers.HelperFunction); string categoryName = GetRandom.String(32); string keyName = GetRandom.String(32); var template = Handlebars.Compile("{{#if_localized CategoryName KeyName}}Primary{{else}}Inverse{{/if_localized}}"); //Act var result = template.Invoke(new { CategoryName = categoryName, KeyName = keyName }); //Assert result.Should().Be("Inverse"); }