Ejemplo n.º 1
0
        public void NuggetParser_ResponseMode_CanParseEntity_EmptyParam()
        {
            var          nuggetTokens = new NuggetTokens("[[[", "]]]", "|||", "///", "(((", ")))");
            NuggetParser nuggetParser = new NuggetParser(nuggetTokens, NuggetParser.Context.ResponseProcessing);
            var          input        = "[[[Title: %0|||]]]";
            var          result       = nuggetParser.ParseString(input, (nuggetString, pos, nugget, i_entity) => {
                Assert.IsTrue(nugget.IsFormatted);
                var message = NuggetLocalizer.ConvertIdentifiersInMsgId(nugget.MsgId);
                message     = String.Format(message, nugget.FormatItems);
                return(message);
            });

            Assert.AreEqual("Title: ", result);
        }
Ejemplo n.º 2
0
        public void NuggetLocalizer_can_translate_unicode_nugget()
        {
            var textLocalizer = new TextLocalizer_Mock_SingleMessage("foo&bar", "blahblah");
            var obj           = new NuggetLocalizer(new i18nSettings(new WebConfigSettingService()), textLocalizer);

            // Lookup HtmlEncoded msgid.
            var pre  = "[[[foo\u0026amp;bar]]]";
            var post = obj.ProcessNuggets(pre, languages);

            Assert.AreEqual("blahblah", post);

            // Lookup un-HtmlEncoded msgid.
            pre  = "[[[foo\u0026bar]]]";
            post = obj.ProcessNuggets(pre, languages);
            Assert.AreEqual("blahblah", post);
        }