public void ParseValidAsync(
            string userData, MentionType expectedType, ulong expectedId, string expectedData)
        {
            bool result = Mention.TryParse(userData, out var mention);

            Assert.True(result);
            Assert.Equal(expectedType, mention.Type);
            Assert.Equal(expectedId, mention.Id);
            Assert.Equal(expectedData, mention.Data);
        }
示例#2
0
 public MentionNode(string source, string id, MentionType type)
     : base(source)
 {
     Id   = id;
     Type = type;
 }
示例#3
0
 public MentionNode(string id, MentionType type)
 {
     Id   = id;
     Type = type;
 }
 public MentionNode(string lexeme, string id, MentionType type)
     : base(lexeme)
 {
     Id   = id;
     Type = type;
 }
示例#5
0
 public InvalidMentionTypeException(MentionType expected, MentionType actual)
 {
     this.expectedType = expected;
     this.actualType   = actual;
 }
示例#6
0
 private static void HandleUser(string text, StringBuilder builder, ref int index, ref MentionType type, char c)
 {
     if (c == '!')
     {
         index++;
         ReadDigits(text, builder, ref index);
     }
     else if (char.IsDigit(c))
     {
         ReadDigits(text, builder, ref index);
     }
     else if (c == '&')
     {
         index++;
         ReadDigits(text, builder, ref index);
         type = MentionType.Role;
     }
 }
示例#7
0
 public Mention(ulong id, MentionType type, string data = null)
 {
     Id   = id;
     Type = type;
     Data = data;
 }