Пример #1
0
        public static ParseException create(ParseExceptionType type, String tag, String context)
        {
            StringBuilder builder = new StringBuilder();

            if (tag != null)
            {
                builder.Append(tag);
            }

            if (context != null)
            {
                if (builder.Length > 0)
                {
                    builder.Append(" - ");
                }

                builder.Append(context);
            }

            if (builder.Length > 0)
            {
                return(new ParseException(type, builder.ToString()));
            }
            else
            {
                return(new ParseException(type));
            }
        }
Пример #2
0
        // JUnit specific setUp method... should be fine done as above... I think
        //protected override void setUp()
        //{
        //    mParseState = new ParseState(Encoding.UTF_8);
        //}

        protected void assertParseThrows(IExtTagParser handler, String line, ParseExceptionType exceptionType)
        {
            try
            {
                handler.parse(line, mParseState);
                Assert.False(true);
            }
            catch (ParseException exception)
            {
                Assert.Equal(exceptionType, exception.type);
            }
        }
Пример #3
0
 public ParseException(ParseExceptionType type, String messageSuffix)
 {
     this.type      = type;
     mMessageSuffix = messageSuffix;
 }
Пример #4
0
 public ParseException(ParseExceptionType type) : this(type, null)
 {
 }
Пример #5
0
 public static ParseException create(ParseExceptionType type, String tag)
 {
     return(create(type, tag, null));
 }