예제 #1
0
        public void Parse_ShouldReturnStringWithInlineImgTags_OnEmojisInAString(string input, string expected)
        {
            var twemoji = new TwemojiLib();

            string actual = twemoji.Parse(input);

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void Parse_ShouldReturnOriginalString_OnNoEmojisInAString(string input)
        {
            var twemoji  = new TwemojiLib();
            var expected = input;

            string actual = twemoji.Parse(input);

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void Parse_ShouldUseCustomOptions_WhenProvided()
        {
            var twemoji  = new TwemojiLib();
            var input    = "🧺";
            var expected = "<img class=\"testClassName\" draggable=\"false\" alt=\"\U0001f9fa\" src=\"test/_testingCustomSrcGenerator_1000x1000_yes_1f9fa.png\"/>";

            string actual = twemoji.Parse(input, (TwemojiOptions options) => {
                options.ClassName            = "testClassName";
                options.Base                 = "test/";
                options.Size                 = "1000x1000";
                options.ImageSourceGenerator = (string icon, ExpandoObject callbackOptions) =>
                {
                    var opt = (TwemojiOptions)callbackOptions;
                    return($"{opt.Base}_testingCustomSrcGenerator_{opt.Size}_yes_{icon}{opt.Ext}");
                };
            });

            Assert.Equal(expected, actual);
        }