public void AsciiToUnicode_Test() { // single smiley var text = @":D"; var expected = "😃"; var actual = EmojiOne.AsciiToUnicode(EmojiOne.ShortNameToUnicode(text)); Assert.AreEqual(expected, actual); }
public void AsciiToUnicode() { // single smiley string text = ":D"; string expected = "😃"; string actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // single smiley with incorrect case (shouldn't convert) text = ":d"; expected = text; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // multiple smileys text = ";) :p :* :)"; expected = "😉 😛 😘 🙂"; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley to start a sentence text = @":\ is our confused smiley."; expected = "😕 is our confused smiley."; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley to end a sentence text = "Our smiley to represent joy is :')"; expected = "Our smiley to represent joy is 😂"; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley to end a sentence with puncuation text = "The reverse to the joy smiley is the cry smiley :'(."; expected = "The reverse to the joy smiley is the cry smiley 😢."; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley to end a sentence with preceeding punctuation text = @"This is the ""flushed"" smiley: :$."; expected = @"This is the ""flushed"" smiley: 😳."; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley inside of an IMG tag (shouldn't convert anything inside of the tag) text = @"Smile <img class=""emojione"" alt="":)"" src=""//cdn.jsdelivr.net/emojione/assets/png/1f604.png"" /> because it's going to be a good day."; expected = text; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // smiley inside of OBJECT tag (shouldn't convert anything inside of the tag) text = @"Smile <object class=""emojione"" data=""//cdn.jsdelivr.net/emojione/assets/svg/1f604.svg"" type=""image/svg+xml"" standby="":)"">:)</object> because it's going to be a good day."; expected = text; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // typical username password fail (shouldn't convert the user:pass, but should convert the last :P) text = @"Please log-in with user:pass as your credentials :P."; expected = @"Please log-in with user:pass as your credentials 😛."; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); // shouldn't replace an ascii smiley in a URL (shouldn't replace :/) text = @"Check out http://www.emojione.com"; expected = text; actual = EmojiOne.AsciiToUnicode(text); Assert.AreEqual(expected, actual); }