Пример #1
0
        public void GetCode_ReturnsErrorCodeAsInt(ErrorCode sut, int expected)
        {
            // Arrange / Action
            var actual = sut.GetCode();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
 /// <summary>
 /// Fires an error occurred event.
 /// </summary>
 /// <param name="code">The associated error code.</param>
 public void RaiseErrorOccurred(ErrorCode code)
 {
     if (ErrorOccurred != null)
     {
         var position       = GetCurrentPosition();
         var errorArguments = new ParseErrorEventArgs(code.GetCode(), code.GetMessage(), position);
         ErrorOccurred(this, errorArguments);
     }
 }
Пример #3
0
        public static Request.Methods Parse(string method)
        {
            string m = method.ToUpper();

            if (m.Equals("GET"))
            {
                return(Request.Methods.GET);
            }
            else if (m.Equals("POST"))
            {
                return(Request.Methods.POST);
            }

            ArgumentException arg = new ArgumentException("Request method not valid.");

            ErrorHandler.Throw(arg, ErrorCode.GetCode(arg));
            throw arg;
        }