You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

EmoteTests.cs 955 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Xunit;
  2. namespace Discord.Tests.Unit
  3. {
  4. public class EmoteTests
  5. {
  6. [Fact]
  7. public void Parse()
  8. {
  9. string input = "<:gopher:243902586946715658>";
  10. var success = EmoteUtilities.TryParseGuildEmote(input, out var result);
  11. var (id, name) = result;
  12. Assert.Equal(243902586946715658UL, id);
  13. Assert.Equal("gopher", name);
  14. }
  15. [Theory]
  16. [InlineData("foo")]
  17. [InlineData("<foo")]
  18. [InlineData("<:foo")]
  19. [InlineData("<:foo>")]
  20. public void Parse_Fail(string data)
  21. {
  22. var success = EmoteUtilities.TryParseGuildEmote(data, out _);
  23. Assert.False(success);
  24. }
  25. [Fact]
  26. public void Format()
  27. {
  28. string result = EmoteUtilities.FormatGuildEmote(243902586946715658, "gopher");
  29. Assert.Equal("<:gopher:243902586946715658>", result);
  30. }
  31. }
  32. }