2018-01-19 00:59:21 +01:00
|
|
|
|
using System.Collections.Generic;
|
2018-05-03 00:56:06 +02:00
|
|
|
|
using Geekbot.net.Lib.Converters;
|
2018-01-19 00:59:21 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Tests.Lib
|
|
|
|
|
{
|
2018-04-30 23:44:19 +02:00
|
|
|
|
public class EmojiConverterTest
|
2018-01-19 00:59:21 +01:00
|
|
|
|
{
|
|
|
|
|
public static IEnumerable<object[]> NumberToEmojiTestData
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
2,
|
|
|
|
|
":two:"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
10,
|
|
|
|
|
"🔟"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
15,
|
|
|
|
|
":one::five:"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
null,
|
|
|
|
|
":zero:"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Theory, MemberData(nameof(NumberToEmojiTestData))]
|
2018-02-04 14:52:30 +01:00
|
|
|
|
public void NumberToEmoji(int number, string expectedResult)
|
2018-01-19 00:59:21 +01:00
|
|
|
|
{
|
|
|
|
|
var emojiConverter = new EmojiConverter();
|
2018-04-30 23:44:19 +02:00
|
|
|
|
var result = emojiConverter.NumberToEmoji(number);
|
2018-01-19 00:59:21 +01:00
|
|
|
|
Assert.Equal(result, expectedResult);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-30 23:44:19 +02:00
|
|
|
|
public static IEnumerable<object[]> TextToEmojiTestData
|
2018-01-19 00:59:21 +01:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
"test",
|
2018-01-29 23:27:28 +01:00
|
|
|
|
":regional_indicator_t: :regional_indicator_e: :regional_indicator_s: :regional_indicator_t: "
|
2018-01-19 00:59:21 +01:00
|
|
|
|
};
|
|
|
|
|
yield return new object[]
|
|
|
|
|
{
|
|
|
|
|
"Best3+?",
|
2018-01-29 23:27:28 +01:00
|
|
|
|
":b: :regional_indicator_e: :regional_indicator_s: :regional_indicator_t: :three: :heavy_plus_sign: :question: "
|
2018-01-19 00:59:21 +01:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-30 23:44:19 +02:00
|
|
|
|
[Theory, MemberData(nameof(TextToEmojiTestData))]
|
2018-02-04 14:52:30 +01:00
|
|
|
|
public void TextToEmoji(string text, string expectedResult)
|
2018-01-19 00:59:21 +01:00
|
|
|
|
{
|
|
|
|
|
var emojiConverter = new EmojiConverter();
|
2018-04-30 23:44:19 +02:00
|
|
|
|
var result = emojiConverter.TextToEmoji(text);
|
2018-01-19 00:59:21 +01:00
|
|
|
|
Assert.Equal(result, expectedResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|