Esempio n. 1
0
        private string ReplaceTemplate(string resourceKey, object fields)
        {
            var replacements = fields.ToDictionary(StringComparer.OrdinalIgnoreCase);

            foreach (var replacement in replacements)
            {
                resourceKey = resourceKey.Replace("{" + Cores.ToHtmlCase(replacement.Key) + "}", replacement.Value?.ToString());
            }

            return(resourceKey);
        }
Esempio n. 2
0
        public void ToHtmlCase()
        {
            var result = Cores.ToHtmlCase("SomeThing");

            Assert.Equal("some-thing", result);
            result = Cores.ToHtmlCase("capsONInside");
            Assert.Equal("caps-on-inside", result);
            result = Cores.ToHtmlCase("CAPSOnOUTSIDE");
            Assert.Equal("caps-on-outside", result);
            result = Cores.ToHtmlCase("ALLCAPS");
            Assert.Equal("allcaps", result);
            result = Cores.ToHtmlCase("One1Two2Three3");
            Assert.Equal("one1-two2-three3", result);
            result = Cores.ToHtmlCase("ONE1TWO2THREE3");
            Assert.Equal("one1two2three3", result);
            result = Cores.ToHtmlCase("First_Second_ThirdHi");
            Assert.Equal("first_second_third-hi", result);
        }