public void Version40Emoji() { // test that new emoji from v4.0 works string text = ":cold_face:"; string expected = $@"<img class=""emojione"" alt=""π₯Ά"" title="":cold_face:"" src=""{EmojiOne.ImagePath}{EmojiOne.EmojiSize}/1f976.png"" />"; string actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); text = "π§"; expected = ":cupcake:"; actual = EmojiOne.ToShort(text); Assert.AreEqual(expected, actual); text = ":superhero:"; expected = "π¦Έ"; actual = EmojiOne.ShortnameToUnicode(text); Assert.AreEqual(expected, actual); }
public void Version224Emoji() { // test that new emoji from v2.2.4 works string text = ":first_place:"; string expected = $@"<img class=""emojione"" alt=""π₯"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f947.png{EmojiOne.CacheBustParam}"" />"; string actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); text = ":avocado:"; expected = "π₯"; actual = EmojiOne.ShortnameToUnicode(text); Assert.AreEqual(expected, actual); text = "π€"; expected = ":black_heart:"; actual = EmojiOne.ToShort(text); Assert.AreEqual(expected, actual); }
public void Version224Emoji() { // test that new emoji from v2.2.4 works string text = ":first_place:"; string expected = $@"<img class=""emojione"" alt=""π₯"" title="":first_place:"" src=""{EmojiOne.ImagePath}{EmojiOne.EmojiSize}/1f947.png"" />"; string actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); text = ":avocado:"; expected = "π₯"; actual = EmojiOne.ShortnameToUnicode(text); Assert.AreEqual(expected, actual); text = "π€"; expected = ":black_heart:"; actual = EmojiOne.ToShort(text); Assert.AreEqual(expected, actual); }
public void ShortnameToImage() { // shortname to image string text = "Hello world! π :smile:"; string expected = $@"Hello world! π <img class=""emojione"" alt=""π"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f604.png{EmojiOne.CacheBustParam}"" />"; string actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); // shortname at start of sentence with apostrophe text = ":snail:'s are cool!"; expected = $@"<img class=""emojione"" alt=""π"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f40c.png{EmojiOne.CacheBustParam}"" />'s are cool!"; actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); // shortname shares a colon text = ":invalid:snail:"; expected = $@":invalid<img class=""emojione"" alt=""π"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f40c.png{EmojiOne.CacheBustParam}"" />"; actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); // mixed ascii, regular unicode and duplicate emoji text = ":alien: is π½ and μ is not :alien: or :alien: also :randomy: is not emoji"; expected = $@"<img class=""emojione"" alt=""π½"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f47d.png{EmojiOne.CacheBustParam}"" /> is π½ and μ is not <img class=""emojione"" alt=""π½"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f47d.png{EmojiOne.CacheBustParam}"" /> or <img class=""emojione"" alt=""π½"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f47d.png{EmojiOne.CacheBustParam}"" /> also :randomy: is not emoji"; actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); // multiline emoji string text = ":dancer:\n:dancer:"; expected = $"<img class=\"emojione\" alt=\"π\" src=\"//cdn.jsdelivr.net/emojione/assets/png/1f483.png{EmojiOne.CacheBustParam}\" />\n<img class=\"emojione\" alt=\"π\" src=\"//cdn.jsdelivr.net/emojione/assets/png/1f483.png{EmojiOne.CacheBustParam}\" />"; actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); // triple emoji string text = ":dancer::dancer::alien:"; expected = $@"<img class=""emojione"" alt=""π"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f483.png{EmojiOne.CacheBustParam}"" /><img class=""emojione"" alt=""π"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f483.png{EmojiOne.CacheBustParam}"" /><img class=""emojione"" alt=""π½"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f47d.png{EmojiOne.CacheBustParam}"" />"; actual = EmojiOne.ShortnameToImage(text); Assert.AreEqual(expected, actual); }