Esempio n. 1
0
 void spellItem_Validated(MenuItem sender, ValidationEventArgs e)
 {
     Combat.ChangeState(BlazeraLib.Combat.EState.SpellCellSelection, new Phase.StartInfo(new Dictionary<string,object>()
     {
         { "Spell", sender.GetText() }
     }));
 }
				// This method doesn't use instance methods/fields so it should be static.
				private static void DoValidationEvent(object sender, ValidationEventArgs e)
				{
					if (e.Severity == XmlSeverityType.Warning)
						Console.WriteLine(e.Message);
					else 
						throw e.Exception;
				}
        private void ValidateTable(ValidationEventArgs e, HtmlAgilityPack.HtmlNode table)
        {
            var columns = table.SelectNodes("//th");

            if (columns == null || columns.Count == 0)
            {
                Fail(e, "Could not locate any columns in the table!");
            }
            else
            {
                int columnIndex = FindColumnIndexByName(columns, ColumnName);

                if (columnIndex == -1)
                {
                    Fail(e, String.Format("Could not find a column named '{0}'!", ColumnName));
                }
                else
                {
                    bool foundTheValue = DoesValueExistInColumn(table, columnIndex, ExpectedValue);

                    if (foundTheValue == true)
                    {
                        Pass(e, "Found the column value!");
                    }
                    else
                    {
                        Fail(e, String.Format("Could not find a cell with the value '{0}'", ExpectedValue));
                    }
                }
            }
        }
 private void GitSourceControlProviderEditor_ValidateBeforeSave(object sender, ValidationEventArgs<ProviderBase> e)
 {
     if (this.chkUseStandardGitClient.Checked && string.IsNullOrEmpty(this.txtGitExecutablePath.Text))
     {
         e.ValidLevel = ValidationLevel.Error;
         e.Message = "You must provide a Git client to use if not using the built-in Git client.";
     }
 }
		private void _edDivideBy_Validating(object sender, ValidationEventArgs<string> e)
		{
			var c = new System.ComponentModel.CancelEventArgs();
			if (null != DivideByValidating)
				DivideByValidating(_edDivideBy.Text, c);
			if (c.Cancel)
				e.AddError("The provided text can not be converted");
		}
Esempio n. 6
0
		private void _edColumnSpacing_Validating(object sender, ValidationEventArgs<string> e)
		{
			bool Cancel = false;
			if (null != _controller)
				Cancel |= _controller.EhColumnSpacingChanged(e.ValueToValidate);
			if (Cancel)
				e.AddError("The provided string could not be converted to a numeric value");
		}
Esempio n. 7
0
		private void _edLeftMargin_Validating(object sender, ValidationEventArgs<string> e)
		{
			bool Cancel = false;
			if (_controller != null)
				Cancel |= _controller.EhLeftMarginChanged(e.ValueToValidate);

			if (Cancel)
				e.AddError("The provided string could not be converted to a numeric value");
		}
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.Headers.ToString().Contains(FindText)) 
     { 
         e.IsValid = true; 
     } else {
         e.IsValid = false; 
     }
 }
        /// <summary>
        /// The validate method.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="ValidationEventArgs"/></param>
        public override void Validate(object sender, ValidationEventArgs e)
        {
            switch (retryTestType)
            {
                    case RetryTestType.StatusCodeEquals:
                    if ((int)e.Response.StatusCode == int.Parse(expectedValue))
                    {
                        e.Message = "Expected status code is correct.";
                    }
                    else
                    {
                        e.IsValid = false;
                        e.Message = string.Format("Expected status code is not correct. Expected: {0} Actual: {1}",
                                                  expectedValue, (int)e.Response.StatusCode);
                    }
                    break;

                    case RetryTestType.BodyEquals:
                    if (e.Response.BodyString == expectedValue)
                    {
                        e.Message = "Expected body is correct.";
                    }
                    else
                    {
                        e.IsValid = false;
                        e.Message = string.Format("Expected body is not correct. Expected: {0} Actual: {1}",
                                                  expectedValue, e.Response.BodyString);
                    }
                    break;

                    case RetryTestType.BodyIncludes:
                    if (e.Response.BodyString.IndexOf(expectedValue, System.StringComparison.Ordinal) > -1)
                    {
                        e.Message = "Body includes expected value.";
                    }
                    else
                    {
                        e.IsValid = false;
                        e.Message = string.Format("Body does not include expected value. Expected: {0} Actual: {1}",
                                                  expectedValue, e.Response.BodyString);
                    }
                    break;

                    case RetryTestType.BodyDoesNotInclude:
                    if (e.Response.BodyString.IndexOf(expectedValue, System.StringComparison.Ordinal) == -1)
                    {
                        e.Message = "Body correctly does not include unwanted value.";
                    }
                    else
                    {
                        e.IsValid = false;
                        e.Message = string.Format("Body includes unwanted value: {0}", expectedValue);
                    }
                    break;
            }
           
        }
 protected void ArrivalDateEdit_Validation(object sender, ValidationEventArgs e)
 {
     if (!(e.Value is DateTime))
         return;
     DateTime selectedDate = (DateTime)e.Value;
     DateTime currentDate = DateTime.Now;
     if (selectedDate.Year != currentDate.Year || selectedDate.Month != currentDate.Month)
         e.IsValid = false;
 }
Esempio n. 11
0
 protected void MinuteStepTextBox_Validation(object sender, ValidationEventArgs e)
 {
     if (CommonUtils.IsNullValue(e.Value) || ((string)e.Value == ""))
         return;
     string strAge = ((string)e.Value).TrimStart('0');
     if (strAge.Length == 0)
         return;
     UInt32 age;
     if (!UInt32.TryParse(strAge, out age) || age < 5 || age > 60)
         e.IsValid = false;
 }
 private void TfsIssueTrackingApplicationFilterEditor_ValidateBeforeCreate(object sender, ValidationEventArgs<IssueTrackerApplicationConfigurationBase> e)
 {
     try
     {
         GC.KeepAlive(this.collections.Value);
     }
     catch (Exception ex)
     {
         e.ValidLevel = ValidationLevel.Error;
         e.Message = "Unable to contact TFS: " + ex.ToString();
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.StatusDescription == expectedStatusDescription)
     {
         e.Message = "The expected status description was returned.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The expected status description was not returned. Expected: {0} Actual: {1}.", expectedStatusDescription, e.Response.StatusDescription);
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if ((int)e.Response.StatusCode == expectedStatusCode)
     {
         e.Message = "The expected status code was returned.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The expected status code was not returned. Expected: {0} Actual: {1}.", expectedStatusCode, (int)e.Response.StatusCode);
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.BodyString.IndexOf(value, System.StringComparison.Ordinal) == -1)
     {
         e.Message = "The body correctly does not include the value.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The body includes the value: {0} in the body: {1}", value, e.Response.BodyString);
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (expectedBody == e.Response.BodyString)
     {
         e.Message = "The expected value was correct.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The expected value was not correct. Expected: {0} Actual {1}.", expectedBody, e.Response.BodyString);
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.IsBodyEmpty)
     {
         e.Message = "The response body is empty as expected.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The response body is not empty. Actual body: {0}.", e.Response.BodyString);
     }
 }
        public override void Validate(object sender, ValidationEventArgs e)
        {
            TotalResPonseTimeValue = TotalResPonseTimeValue + e.Response.Statistics.MillisecondsToLastByte;

            if (TotalResPonseTimeValue > ThresholdTimeValue)
            {
                e.IsValid = false;
             //   e.Message = String.Format("Total Request Time {0:00000} Exceeded Threshold {1:00000) ", TotalResPonseTimeValue, ThresholdTimeValue);
                e.Message = "Total Request Time " + TotalResPonseTimeValue + "Exceeded Threshold "+ ThresholdTimeValue;

            }
        }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.BodyString.IndexOf(expectedIncludedValue, System.StringComparison.Ordinal) > -1)
     {
         e.Message = "The body included the expected value.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The body did not include the expected value. Expected value: {0} Actual body: {1}", expectedIncludedValue, e.Response.BodyString);
     }
 }
 /// <summary>
 /// The validate method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ValidationEventArgs"/></param>
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (e.Response.ContentLength == expectedContentLength)
     {
         e.Message = "The content length was correct.";
     }
     else
     {
         e.IsValid = false;
         e.Message = string.Format("The content length was not correct. Expected: {0} Actual: {1}.", expectedContentLength, e.Response.ContentLength);
     }
 }
Esempio n. 21
0
 static void vHandle(object sender, ValidationEventArgs e)
 {
     if (e.Severity == XmlSeverityType.Warning)
     {
         //Debug.LogWarning("WARNING: " + e.Message);
         throw new System.Exception();
     }
     else if (e.Severity == XmlSeverityType.Error)
     {
         //Debug.LogError("ERROR: " + e.Message);
         throw new System.Exception();
     }
 }
Esempio n. 22
0
 private void ValidationCallBack(object sender, ValidationEventArgs args)
 {
     if (args.Severity == XmlSeverityType.Warning) {
         //Debug.Log("Warning: " + args.Message);
         log += "Warning: " + args.Message + "\n";
     } else {
         if (args.Message.IndexOf("Character content not allowed") == -1) { // ignore this error which gets thrown all the time for no reason
             isValid = false;
             //Debug.Log("Error: " + args.Message);
             log += "Error: " + args.Message + "\n";
         }
     }
 }
Esempio n. 23
0
    public static void MyValidationEventHandler(Object sender, ValidationEventArgs args)
    {
        isValid = false;
        IXmlLineInfo v = (IXmlLineInfo)sender;

        if (v.HasLineInfo())
        {
            Console.Error.WriteLine("Warning: Line " + v.LineNumber + ", Position " + v.LinePosition + "; " + args.Message + "\n");
        }
        else
        {
            Console.Error.WriteLine("Warning: " + args.Message + "\n");
        }
    }
        /// <summary>
        /// The validate method.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="ValidationEventArgs"/></param>
        public override void Validate(object sender, ValidationEventArgs e)
        {
            var assertActionResult = action(e.Response);

            if(assertActionResult.Success)
            {
                e.Message = assertActionResult.Message;
            }
            else
            {
                e.IsValid = false;
                e.Message = assertActionResult.ErrorMessage;
            }
        }
Esempio n. 25
0
 // Display any warnings or errors.
 private static void ValidationCallBack(object sender, ValidationEventArgs args)
 {
     if (args.Severity == XmlSeverityType.Warning)
     {
         System.Console.WriteLine("\tWarning: Matching schema not found.  No validation occurred." + args.Message);
         System.Console.ReadLine();
     }
     else
     {
         System.Console.WriteLine("\tValidation error: " + args.Message);
         System.Console.ReadLine();
     }
     System.Console.ReadLine();
 }
Esempio n. 26
0
        public override void Validate(object sender, ValidationEventArgs e)
        {
            using (new RuleCheck(e, this.StopOnError))
            {
                Cookie cookie = e.Response.Cookies[this.CookieName];

                if (cookie != null)
                {
                    if (cookie.Expires < DateTime.Now)
                    {
                        // Success, cookie is set to expire

                        // Check if cookie domain matches if domain is specified
                        if (!string.IsNullOrEmpty(this.Domain))
                        {
                            if (cookie.Domain != this.Domain)
                            {
                                e.IsValid = false;
                                e.Message = "Cookie is set to expire on domain '" + cookie.Domain + "' but it needs to expire on '" + this.Domain + "'";
                            }
                        }
                        else
                        {
                            // If domain is not specified, then cookie must expire on current domain
                            if (!string.IsNullOrEmpty(cookie.Domain) && cookie.Domain != e.Response.ResponseUri.Host)
                            {
                                e.IsValid = false;
                                e.Message = "Cookie is set to expire on domain '" + cookie.Domain + "' but it needs to expire on '" + e.Response.ResponseUri.Host + "'";
                            }
                        }
                    }
                    else
                    {
                        // Fail, cookie is not set to expire
                        e.IsValid = false;
                        e.Message = this.CookieName + " " + "is not removed";
                        return;
                    }
                }
                else
                {
                    // Fail, Cookie does not exist in response
                    e.IsValid = false;
                    e.Message = this.CookieName + " " + "is not present in response";
                    return;

                }
            }
        }
        private void VisualStudioComSourceControlProviderEditor_ValidateBeforeSave(object sender, ValidationEventArgs<ProviderBase> e)
        {
            Uri uri;
            if (!Uri.TryCreate(this.txtBaseUrl.Text, UriKind.Absolute, out uri))
            {
                e.ValidLevel = ValidationLevel.Error;
                e.Message = string.Format("{0} is not a valid URL.", this.txtBaseUrl.Text);
                return;
            }

            if (uri.Host.IndexOf("visualstudio.com", StringComparison.OrdinalIgnoreCase) < 0)
            {
                e.ValidLevel = ValidationLevel.Warning;
                e.Message = "This provider is only intended for use with TFS hosted at visualstudio.com";
                return;
            }
        }
Esempio n. 28
0
        //---------------------------------------------------------------------
        public override void Validate(object sender, ValidationEventArgs e)
        {
            RestObject response = ValidateJson(sender, e);
            if (null == response)
                return;
            foreach (var p in PropertyNames.Split(','))
            {
                if (null == response[p])
                {
                    e.Message = String.Format("'{0}' Not Found", p);
                    e.IsValid = false;
                    return;
                }
            }
            e.IsValid = true;

            //e.WebTest.Context.Add(ContextParameterName, propertyValue);
        }
Esempio n. 29
0
        public override void Validate(object sender, ValidationEventArgs e)
        {
            using (new RuleCheck(e, this.StopOnError))
            {
                Cookie cookie = e.Request.Cookies[this.CookieName];

                if (cookie != null)
                {
                    e.IsValid = false;
                    e.Message = this.CookieName + " " + "is not removed";
                    return;
                }
                else
                {
                    // Cookie does not exist in request, so it has been removed
                }
            }
        }
 public override void Validate(object sender, ValidationEventArgs e)
 {
     if (String.IsNullOrWhiteSpace(TableId) == true)
     {
         Fail(e, "Table Id does not have a valid value.");
     }
     else if (String.IsNullOrWhiteSpace(ColumnName) == true)
     {
         Fail(e, "Column name does not have a valid value.");
     }
     else if (ExpectedValue == null)
     {
         Fail(e, "Expected value cannot be null.");
     }
     else
     {
         ValidateTable(e);
     }
 }
Esempio n. 31
0
 private static void ValidationCallbackWithErrorCode(object sender, ValidationEventArgs args)
 {
     Console.WriteLine("Schema warning: " + args.Message);
 }
Esempio n. 32
0
 public void ValidationHandler(object sender, ValidationEventArgs args)
 {
     logger.Log("Validation error", true);
     logger.Log($"\tSeverity:{args.Severity}");
     logger.Log($"\tMessage:{args.Message}");
 }
Esempio n. 33
0
 private void reader_ValidationEventHandler(object sender, ValidationEventArgs e)
 {
     cErro += "Linha: " + e.Exception.LineNumber + " Coluna: " + e.Exception.LinePosition + " Erro: " + e.Exception.Message + "\r\n";
 }
Esempio n. 34
0
 /// <summary>
 /// Called when there was an issue with validating the XML file.
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="args">String containing the issue with the XML file.</param>
 private void ValidationFailed(object sender, ValidationEventArgs args)
 {
     m_bIsFailure = true;
     MessageBox.Show("Invalid XML File: " + args.Message);
 }
 public static void ValidationHandler(object sender, ValidationEventArgs args)
 {
     eMessage += args.Message + "\r\n";
 }
Esempio n. 36
0
 private void MyEvent(object sender, ValidationEventArgs e)
 {
     isValid           = false;
     ValidationMessage = "Document is invalid" + e.Message;
 }
Esempio n. 37
0
 private static void LoadXmlSchemaValidationEventHandler(object sender, ValidationEventArgs e)
 {
     //// Throw an exception when a warning or an error occurs while loading the XML schema.
     //// In case the schema is not loaded correctly the validation against the schema might be incorrect.
     throw new InvalidOperationException("Error while loading XML schema. Validation can not be performed.");
 }
Esempio n. 38
0
 private void AnimlDocumentValidationEventHandler(object sender, ValidationEventArgs e)
 {
     this.ValidationMessages.Add($"{e.Severity}: {e.Message}");
 }
Esempio n. 39
0
 /*
  * a validation event handler
  * control reaches here in case of invalid xml
  */
 private static void ValidationCallBack(object sender, ValidationEventArgs e)
 {
     flag = true;
     msg += "Validation Error: " + e.Message;
 }
Esempio n. 40
0
 private static void OnValidationEvent(object sender, ValidationEventArgs e)
 {
     Console.WriteLine(e.Message);
 }
Esempio n. 41
0
 private void ValidationCallBack(object sender, ValidationEventArgs e)
 {
     throw new Exception(e.Message);
 }
Esempio n. 42
0
 /// <summary>
 /// Handles a valdiation error.
 /// </summary>
 static void OnValidate(object sender, ValidationEventArgs args)
 {
     throw new InvalidOperationException(args.Message, args.Exception);
 }
Esempio n. 43
0
 // Display any validation errors.
 private static void ValidationCallBack(object sender, ValidationEventArgs e)
 {
     Console.WriteLine("Validation Error: {0}", e.Message);
     Environment.Exit(-1);
 }
Esempio n. 44
0
 public void ValidationHandler(object sender, ValidationEventArgs args)
 {
     throw new ValidationException("XML Schema Validation error : " + args.Message);
 }
Esempio n. 45
0
 private void ValidationCallBack(object sender, ValidationEventArgs e)
 {
     richTextBox1.Text += e.Message + "\n";
 }
Esempio n. 46
0
 public void ValidationHandler(object sender, ValidationEventArgs args)
 {
     throw new NotAnOoxDocumentException("XML Schema Validation error : " + args.Message);
     //throw new PptxValidatorException("XML Schema Validation error : " + args.Message);
 }
Esempio n. 47
0
 public void ShowCompileErrors(object sender, ValidationEventArgs args)
 {
     MessageBox.Show(args.Message, "XML File error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     _db_loaded = false;
 }
Esempio n. 48
0
 private void Settings_ValidationEventHandler(object sender, ValidationEventArgs e)
 {
     Console.Write(e.Message);
 }
 public static void ValidationCallbackOne(object sender, ValidationEventArgs args)
 {
     Console.WriteLine(args.Message);
 }
 /// <summary>
 /// writes output of validation to console
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">event</param>
 private static void XmlReadFileValidation(object sender, ValidationEventArgs e)
 {
     Console.WriteLine("Validation Error: {0}", e.Message);
 }
Esempio n. 51
0
 private static void ValidationCallBack(object sender, ValidationEventArgs args)
 {
     throw new Exception("Error in Schema - " + args.Message);
 }
Esempio n. 52
0
 private static void SchemaSetValidationEventHandler(object sender, ValidationEventArgs e)
 {
 }
 private void ValidationHandler(object sender, ValidationEventArgs args)
 {
     errors.Add(args);
 }
 private static void HandleSchemaEvent(object sender, ValidationEventArgs args)
 {
     Log.Info("Loading config schema: " + args.Message);
 }
Esempio n. 55
0
 private void callback(object sender, ValidationEventArgs args)
 {
     errorCount++;
     _output.WriteLine(args.Message);
 }
Esempio n. 56
0
 // this gets called when a validation error occurs
 private void TestValidationHandler(object sender, ValidationEventArgs e)
 {
     validationSucceded = false;
 }
Esempio n. 57
0
 void settings_ValidationEventHandler(object sender, ValidationEventArgs e)
 {
     Message.Trace(Severity.Error, Properties.Resources.VulcanConfigValidationError, _configFile, e.Severity, e.Message);
 }
Esempio n. 58
0
 private static void ConfigSettingsValidationEventHandler(object sender, ValidationEventArgs e)
 {
     throw new ValidatorConfigurationException("An exception occurred parsing configuration :" + e.Message, e.Exception);
 }
Esempio n. 59
0
 private static void OldSchemaValidationCallBack(object sender, ValidationEventArgs args)
 {
     throw (new Exception(String.Format("XML Validation error:" + args.Message)));
 }
Esempio n. 60
0
 protected void cmbClassSched_Validation(object sender, ValidationEventArgs e)
 {
     Session["classid"] = 0;
     Session["classid"] = ((ASPxComboBox)sender).Value;
 }