1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-10-19 13:26:12 +00:00
X10D/X10D.Tests/src/Text/CharTests.cs

57 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using X10D.Text;
namespace X10D.Tests.Text;
[TestClass]
public class CharTests
{
[TestMethod]
public void IsEmoji_ShouldReturnTrue_GivenBasicEmoji()
{
Assert.IsTrue('✂'.IsEmoji());
Assert.IsTrue('✅'.IsEmoji());
Assert.IsTrue('❎'.IsEmoji());
Assert.IsTrue(''.IsEmoji());
Assert.IsTrue(''.IsEmoji());
}
[TestMethod]
public void IsEmoji_ShouldReturnFalse_GivenNonEmoji()
{
for (var letter = 'A'; letter <= 'Z'; letter++)
{
Assert.IsFalse(letter.IsEmoji());
}
}
[TestMethod]
public void RepeatShouldBeCorrect()
{
const string expected = "aaaaaaaaaa";
string actual = 'a'.Repeat(10);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void RepeatOneCountShouldBeLength1String()
{
string repeated = 'a'.Repeat(1);
Assert.AreEqual(1, repeated.Length);
Assert.AreEqual("a", repeated);
}
[TestMethod]
public void RepeatZeroCountShouldBeEmpty()
{
Assert.AreEqual(string.Empty, 'a'.Repeat(0));
}
[TestMethod]
public void RepeatNegativeCountShouldThrow()
{
Assert.ThrowsException<ArgumentOutOfRangeException>(() => 'a'.Repeat(-1));
}
}