public void CanAttributeConstraintErrorsIndividually() { IFeatureClass fcLine1; IFeatureClass fcLine2; IFeatureClass fcBorder1; IFeatureClass fcBorder2; CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2); // border lines are coincident AddLineFeature(fcBorder1, 0, 0, 10, 0, stateId: "A"); AddLineFeature(fcBorder2, 10, 0, 0, 0, stateId: "B"); // connected to border: AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A", textFieldValue: "X"); // dummy to run AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A"); // connected to border, exact match: AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B", textFieldValue: "Y"); using (AssertUtils.UseInvariantCulture()) { var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1, fcLine2, fcBorder2, 0) { LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE", LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE", BorderingLineMatchCondition = "LINE1.STATE <> LINE2.STATE", BorderingLineAttributeConstraint = "LINE1.STATE = LINE2.STATE", BorderingLineEqualAttributes = _textFieldName, ReportIndividualAttributeConstraintViolations = true }; AssertUtils.ExpectedErrors(2, Run(test, 1000), e => e.Description == "Values are not equal (FLD_TEXT:'X','Y')" && e.AffectedComponent == "FLD_TEXT" && e.IssueCode?.ID == "BorderingLines.Match.ConstraintsNotFulfilled", e => e.Description == "Constraint is not fulfilled (LINE1.STATE:'A';LINE2.STATE:'B')" && e.AffectedComponent == "STATE" && e.IssueCode?.ID == "BorderingLines.Match.ConstraintsNotFulfilled" ); AssertUtils.ExpectedErrors(2, Run(test, 5)); } }
public void CanAttributeConstraintErrorsIndividually() { IFeatureClass fcPoint1; IFeatureClass fcPoint2; IFeatureClass fcBorder1; IFeatureClass fcBorder2; CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2); // border lines are coincident AddLineFeature(fcBorder1, 0, 0, 10, 0, stateId: "A"); AddLineFeature(fcBorder2, 10, 0, 0, 0, stateId: "B"); DateTime dateValue = new DateTime(2000, 12, 31); // point on border: AddPointFeature(fcPoint1, 5, 0, "A", "Y#X", 10.001, dateValue); // point on border, exact match: AddPointFeature(fcPoint2, 5, 0, "B", "X#Y", 10.002, dateValue + TimeSpan.FromDays(1)); using (AssertUtils.UseInvariantCulture()) { var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1, fcPoint2, fcBorder2, searchDistance: 0.5) { PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE", PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE", BorderingPointMatchCondition = "POINT1.STATE <> POINT2.STATE", BorderingPointEqualAttributes = "FLD_TEXT:#, FLD_DOUBLE, FLD_DATE", ReportIndividualAttributeConstraintViolations = true }; AssertUtils.ExpectedErrors( 2, Run(test), e => e.Description == "Values are not equal (FLD_DOUBLE:10.001,10.002)" && e.AffectedComponent == "FLD_DOUBLE" && e.IssueCode?.ID == "BorderingPoints.Match.ConstraintsNotFulfilled", e => e.Description == "Values are not equal (FLD_DATE:01/01/2001 00:00:00,12/31/2000 00:00:00)" && e.AffectedComponent == "FLD_DATE" && e.IssueCode?.ID == "BorderingPoints.Match.ConstraintsNotFulfilled"); } }