protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_AttendanceMode() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//xcri12:attendanceMode" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_Catalog() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//xcri12:catalog" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_Qualifications() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//mlo:qualification" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_ProviderNotWithinVenue() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//xcri12:provider[not(ancestor::xcri12:venue)]" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_Locations() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//xcri12:provider/mlo:location" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_Credit() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "//mlo:credit" }; return(elementValidator); }
protected XCRI.Validation.ContentValidation.ElementValidator GetElementValidator_PresentationWithCampusAttendanceMode() { var elementValidator = new XCRI.Validation.ContentValidation.ElementValidator() { NamespaceManager = this.GetNamespaceManager(), XPathSelector = "(//xcri12:presentation[.//xcri12:attendanceMode/text()='Campus']|//xcri12:presentation[.//xcri12:attendanceMode[@identifier='CM']])" }; return(elementValidator); }
public void TestMultipleIdentifiersWithoutXsiTypeDoNotExistUnderElement ( XCRI.Validation.ContentValidation.ElementValidator ev, System.Xml.Linq.XElement element, int expectedFailures, int expectedSuccesses ) { var v = new XCRI.Validation.ContentValidation.NumberValidator() { XPathSelector = "count(./dc:identifier[not(@xsi:type)])", ExceptionMessage = "All courses must contain an identifier without an xsi:type attribute", FailedValidationStatus = XCRI.Validation.ContentValidation.ValidationStatus.Exception, Minimum = 0, Maximum = 1, ValidationGroup = "Structure", NamespaceManager = ev.NamespaceManager }; ev.Validators.Add(v); var vr = ev .Validate(element) .Where(r => r.Message == v.ExceptionMessage); Assert.AreEqual <int>(1, vr.Count()); ValidateResults ( result: vr.ElementAt(0), expectedStatus: (0 == expectedFailures) ? XCRI.Validation.ContentValidation.ValidationStatus.Passed : XCRI.Validation.ContentValidation.ValidationStatus.Exception, expectedInstances: expectedFailures + expectedSuccesses, expectedFailedCount: expectedFailures, expectedSuccessfulCount: expectedSuccesses ); ev.Validators.Clear(); }
public void TestLocationExistsUnderElement ( XCRI.Validation.ContentValidation.ElementValidator ev, System.Xml.Linq.XElement element, int expectedFailures, int expectedSuccesses ) { var v = new XCRI.Validation.ContentValidation.NumberValidator() { XPathSelector = "count(./mlo:location)", ExceptionMessage = "All providers must contain a location", FailedValidationStatus = XCRI.Validation.ContentValidation.ValidationStatus.Exception, Minimum = 1, ValidationGroup = "Structure", NamespaceManager = ev.NamespaceManager }; ev.Validators.Add(v); var vr = ev .Validate(element) .Where(r => r.Message == v.ExceptionMessage); Assert.AreEqual <int>(1, vr.Count()); ValidateResults ( result: vr.ElementAt(0), expectedStatus: (0 == expectedFailures) ? XCRI.Validation.ContentValidation.ValidationStatus.Passed : XCRI.Validation.ContentValidation.ValidationStatus.Exception, expectedInstances: expectedFailures + expectedSuccesses, expectedFailedCount: expectedFailures, expectedSuccessfulCount: expectedSuccesses ); ev.Validators.Clear(); }