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 1.1 kB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Xunit;
  5. namespace Discord.Tests.Unit
  6. {
  7. public class EmoteTests
  8. {
  9. [Fact]
  10. public void Parse()
  11. {
  12. string input = "<:gopher:243902586946715658>";
  13. var (resultId, resultName) = EmoteUtilities.ParseGuildEmote(input);
  14. Assert.Equal(243902586946715658UL, resultId);
  15. Assert.Equal("gopher", resultName);
  16. Assert.Throws<ArgumentException>(() => EmoteUtilities.ParseGuildEmote("foo"));
  17. Assert.Throws<ArgumentException>(() => EmoteUtilities.ParseGuildEmote("<foo"));
  18. Assert.Throws<ArgumentException>(() => EmoteUtilities.ParseGuildEmote("<:foo"));
  19. Assert.Throws<ArgumentException>(() => EmoteUtilities.ParseGuildEmote("<:foo>"));
  20. }
  21. [Fact]
  22. public void Format()
  23. {
  24. string result = EmoteUtilities.FormatGuildEmote(243902586946715658, "gopher");
  25. Assert.Equal("<:gopher:243902586946715658>", result);
  26. }
  27. }
  28. }