Пример #1
0
        public void ParseToList_ShouldReturnImgsList_OnEmojiesInAString()
        {
            var twemoji  = new TwemojiLib();
            var input    = "123🧺32a🧺fdsdf🧺fsafd";
            var expected = new List <TwemojiImg> {
                new TwemojiImg()
                {
                    Emoji = "🧺",
                    Src   = "https://twemoji.maxcdn.com/v/13.0.1/72x72/1f9fa.png",
                },
                new TwemojiImg()
                {
                    Emoji = "🧺",
                    Src   = "https://twemoji.maxcdn.com/v/13.0.1/72x72/1f9fa.png",
                },
                new TwemojiImg()
                {
                    Emoji = "🧺",
                    Src   = "https://twemoji.maxcdn.com/v/13.0.1/72x72/1f9fa.png",
                },
            };

            List <TwemojiImg> actual = twemoji.ParseToList(input);

            Assert.Equal(expected, actual, new TwemojiImgComparer());
        }
Пример #2
0
        public void ParseToList_ShouldUseCustomOptions_WhenProvided()
        {
            var twemoji  = new TwemojiLib();
            var input    = "🧺";
            var expected = new List <TwemojiImg> {
                new TwemojiImg()
                {
                    Emoji = "🧺",
                    Src   = "test/_testingCustomSrcGenerator_1000x1000_yes_1f9fa.png",
                },
            };

            var actual = twemoji.ParseToList(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, new TwemojiImgComparer());
        }
Пример #3
0
        public void ParseToList_ShouldReturnEmptyList_OnNoEmojisInAString(string input)
        {
            var twemoji = new TwemojiLib();

            List <TwemojiImg> actual = twemoji.ParseToList(input);

            Assert.Empty(actual);
        }