/// <summary> /// Handles the specified <see cref="ValidationResultCollection"/> with the specified parameters. /// </summary> /// <param name="validationResults">The <see cref="ValidationResultCollection"/> to handle.</param> /// <param name="p">The parameters to use during handling.</param> public void Handle(ValidationResultCollection validationResults, params object[] p) { TestManager.Register(TestItemType.ValidationResult, validationResults, validationResults.IsSucceeded ? TestAction.ValidationSucceeded : TestAction.ValidationFailed, validationResults.ToString()); if (!validationResults.IsSucceeded) { Console.WriteLine(validationResults.ConvertToString(Environment.NewLine)); throw new ValidationFailedException(validationResults); } }
public void ValidationResult_ToString_WithCorrectFormat() { ValidationResultCollection collection = new ValidationResultCollection(); collection.Add(new ValidationResult("This is an error message", new string[] { "Property1", "Property2" })); collection.Add(new ValidationResult("This is an error message", new string[] { "Property1", "Property2" })); Assert.AreEqual("This is an error message (Property1, Property2)\nThis is an error message (Property1, Property2)\n", collection.ToString()); }
public PayException(ValidationResultCollection validationResultCollection) : base(validationResultCollection?.ToString()) { }