本文整理汇总了C#中ValidationResults.AddAllResults方法的典型用法代码示例。如果您正苦于以下问题:C# ValidationResults.AddAllResults方法的具体用法?C# ValidationResults.AddAllResults怎么用?C# ValidationResults.AddAllResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationResults
的用法示例。
在下文中一共展示了ValidationResults.AddAllResults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckLink
public void CheckLink(ValidationResults results) {
var validator = ValidationFactory.CreateValidator<ChangesetLink>();
var linkResults = validator.Validate(Link);
if(!linkResults.IsValid) {
results.AddAllResults(linkResults);
}
}
示例2: CheckProjects
public void CheckProjects(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(TestPublishProjectMapping),
string.Empty);
foreach (TestPublishProjectMapping project in Projects) {
var projectResults = validator.Validate(project);
if(!projectResults.IsValid) {
results.AddAllResults(projectResults);
}
}
}
示例3: DoValidateSave
public void DoValidateSave(ValidationResults results)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<TrainingEstimate>(this.Training, "Save"));
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<TravelEstimate>(this.Travel, "Save"));
}
示例4: DoValidateEstimates
public void DoValidateEstimates(ValidationResults results)
{
if (this.HasTraining)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<TrainingEstimate>(this.Training, "Estimates"));
if (!this.Training.StartingDate.IsBetween(this.EventStart, this.EventEnd, true))
{
results.AddResult(new ValidationResult(
"The start date is not valid.",
typeof(TrainingEstimate), "", "training start date", null));
}
if (!this.Training.EndingDate.IsBetween(this.EventStart, this.EventEnd, true))
{
results.AddResult(new ValidationResult(
"The end date is not valid",
typeof(TrainingEstimate), "", "training start date", null));
}
}
if (this.HasTravel)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<TravelEstimate>(this.Travel, "Estimates"));
}
if (this.MiscealleanousCostsComments.Length > 0 && this.MisceallaneousCosts <= 0M)
{
results.AddResult(new ValidationResult("General comments estimated cost is required.",
typeof(TravelAndTrainingRequest),
"", "", null));
}
else if (this.MisceallaneousCosts != 0M &&
this.MiscealleanousCostsComments.Length == 0)
{
results.AddResult(new ValidationResult("General comments are required.",
typeof(TravelAndTrainingRequest),
"", "", null));
}
}
示例5: CanAddValidationResultsFromCollection
public void CanAddValidationResultsFromCollection()
{
ValidationResults validationResults = new ValidationResults();
validationResults.AddResult(new ValidationResult("existing 1", null, null, null, null));
validationResults.AddResult(new ValidationResult("existing 2", null, null, null, null));
ValidationResult[] newValidationResults = new ValidationResult[]
{
new ValidationResult("new 1", null, null, null, null),
new ValidationResult("new 2", null, null, null, null),
new ValidationResult("new 3", null, null, null, null)
};
validationResults.AddAllResults(newValidationResults);
IDictionary<string, ValidationResult> resultsMapping = ValidationTestHelper.GetResultsMapping(validationResults);
Assert.AreEqual(5, resultsMapping.Count);
Assert.IsTrue(resultsMapping.ContainsKey("existing 1"));
Assert.IsTrue(resultsMapping.ContainsKey("existing 2"));
Assert.IsTrue(resultsMapping.ContainsKey("new 1"));
Assert.IsTrue(resultsMapping.ContainsKey("new 2"));
Assert.IsTrue(resultsMapping.ContainsKey("new 3"));
}
示例6: DoValidate
/// <summary>
/// Does the validate.
/// </summary>
/// <param name="objectToValidate">The object to validate.</param>
/// <param name="currentTarget">The current target.</param>
/// <param name="key">The key.</param>
/// <param name="validationResults">The validation results.</param>
protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)
{
Validator validator = new ValidationIntegrationHelper(this).GetValidator();
if (validator != null)
{
ValidationResults results = validator.Validate(this);
if (!results.IsValid)
{
validationResults.AddAllResults(results);
}
}
}
示例7: CheckMandatoryFields
public void CheckMandatoryFields(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(ClearQuestField), string.Empty);
foreach(ClearQuestField field in MandatoryFields) {
var fieldResults = validator.Validate(field);
if(!fieldResults.IsValid) {
results.AddAllResults(fieldResults);
}
}
}
示例8: CheckPriorityMappings
public void CheckPriorityMappings(ValidationResults results) {
var validator = ValidationFactory.CreateValidator<ClearQuestPriorityMapping>();
foreach(ClearQuestPriorityMapping mapping in PriorityMappings) {
var mappingValidationResults = validator.Validate(mapping);
if(!mappingValidationResults.IsValid) {
results.AddAllResults(mappingValidationResults);
}
}
}
示例9: DoValidateSubmit
public void DoValidateSubmit(ValidationResults results)
{
if (!this.HasFlightArrangements && !this.HasGroundArrangements && !this.HasLodgingArrangements)
results.AddResult(new ValidationResult("At least one travel arrangement is required.",
typeof(TravelEstimate), "", "travel arrangement", null));
else
{
if (this.HasFlightArrangements)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Airfare>(this.FlightArrangements, "Submit"));
}
if (this.HasGroundArrangements)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Ground>(this.GroundArrangements, "Submit"));
}
if (this.HasLodgingArrangements)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Lodging>(this.LodgingArrangements, "Submit"));
}
}
}
示例10: CheckProjectMappings
public void CheckProjectMappings(ValidationResults results)
{
var validator = ValidationFactory.CreateValidator<JiraProjectMapping>();
foreach (var mapping in ProjectMappings)
{
var mappingValidationResults = validator.Validate(mapping);
if (!mappingValidationResults.IsValid)
{
results.AddAllResults(mappingValidationResults);
}
}
}
示例11: DoValidateSave
public void DoValidateSave(ValidationResults results)
{
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Airfare>(this.FlightArrangements, "Save"));
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Ground>(this.GroundArrangements, "Save"));
results.AddAllResults(
Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<Lodging>(this.LodgingArrangements, "Save"));
}
示例12: CheckPriorityMappings
public void CheckPriorityMappings(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(QCPriorityMapping), string.Empty);
foreach(QCPriorityMapping mapping in PriorityMappings) {
results.AddAllResults(validator.Validate(mapping));
}
}
示例13: CheckConnection
public void CheckConnection(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(QCConnection), string.Empty);
var defectFilterResults = validator.Validate(Connection);
results.AddAllResults(defectFilterResults);
}
示例14: CheckDefectFilters
public void CheckDefectFilters(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(QCDefectFilter), string.Empty);
foreach(QCDefectFilter filter in DefectFilters) {
results.AddAllResults(validator.Validate(filter));
}
}
示例15: CheckProjects
public void CheckProjects(ValidationResults results) {
var validator = ValidationFactory.CreateValidatorFromAttributes(typeof(QCProject), string.Empty);
foreach(QCProject project in Projects) {
results.AddAllResults(validator.Validate(project));
}
}